关于图像的反转(2分)

  • 主题发起人 主题发起人 yz_qing
  • 开始时间 开始时间
Y

yz_qing

Unregistered / Unconfirmed
GUEST, unregistred user!
哪们富翁可以提供一下图像反转的思路?我从没有做过对图像的处理方面的东西。[?]
 
怎么反转?上下、左右、竟面?
思路类似于矩阵的转置
 
矩阵的转置是什么思路呀?反转就是转180度呀
 
使图片旋转

类 别:图形

在窗体中添加一个button和一个image,选择一幅大约100x100的bitmap。
unit drawunit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
rotateimage:timage;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
const
rotation = 2/3*pi;
var
x,y : integer;
newx,newy : integer;
radius,a : real;
begin
form1.WindowState:=wsMaximized;
image1.Visible:=false;
button1.Visible:=false;
rotateimage:=timage.Create(self);
rotateimage.parent:=self;
rotateimage.Left:=0;
rotateimage.Top:=0;
rotateimage.width:=740;
rotateimage.Height:=540;
for x:=1 to image1.Picture.Width do
begin
for y:=1 to image1.Height do
begin
radius:=Sqrt(Sqr(X)+Sqr(Y));
a:=Arctan(Y/X);
newx:=round(Radius*Cos(A+Rotation)+300);
newy:=round(Radius*Sin(A+Rotation)+300);
rotateimage.Canvas.Pixels[newx,newy]:=image1.Canvas.Pixels[x,y];
end;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
rotateimage.free;
end;
end.


 
多人接受答案了。
 
后退
顶部