关于二值变换的问题运行不出来怎么办
procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.Execute then
image1.Picture.Bitmap.LoadFromFile(opendialog1.filename);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
NewBitmap:tbitmap;
i,j:integer;
n:real;
begin
NewBitmap:=tbitmap.Create;
NewBitmap.Width:=image1.Width;
NewBitmap.height:=image1.height;
for i:=0 to image1.Width+1 do
begin
n:=random(255);
for j:=0 to image1.height+1 do
begin
if n<=100 then
NewBitmap.Canvas.Pixels[i,j]:=rgb(0,0,0)
else
newbitmap.Canvas.Pixels[i,j]:=rgb(255,255,255);
end;
Image1.Canvas.Draw(0,0,NewBitmap);
NewBitmap.free;
end;
end;
end.运行的时候进行二值变换的时候就出现错误提示
[此贴子已经被作者于2007-4-2 14:54:56编辑过]