J
Jar
Unregistered / Unconfirmed
GUEST, unregistred user!
在编译程序时,出现了如下错误: Project MyProject.exe raised xception classViolation
with message 'AccessViolation at address 00404AA5 in module "MyProject.exe".Read of
address FFFFFFFF.Process stopped.Use Step or Run to continue.源程序是有关一个bmp图象
的灰度值存储的,如下:procedure TMainForm.FileInput_bitmapClick(Sender: TObject);
var
pByteArray;
LastArray:array of array of byte;
Image_Name:String;
i,j,k:Integer;
begin
OpenPictureDialog1.Filter:='BitMap(*.bmp)|*.bmp';
if OpenPictureDialog1.Execute then
Image_Name:= OpenPictureDialog1.FileName;
Image1.Picture.LoadFromFile(Image_Name);
Image1.Picture.Bitmap.pixelformat := pf24bit;
SetLength(LastArray,Image1.Picture.bitmap.Height-1);//**
for i:=0 to Image1.Picture.bitmap.Height-1do
//**
SetLength(LastArray,Image1.Picture.bitmap.Width-1);//**
for i:=0 to Image1.Picture.bitmap.Height-1do
begin
//**
P:=Image1.Picture.BitMap.ScanLine;
//**
for j:=0 to Image1.Picture.bitmap.Width-1do
begin
k:=P[3*j]*28+P[j*3+1]*151+P[j*3+2]*77;
k:=k shr 6;
LastArray[i,j]:=byte(k);
end;
end;
end;
我想把转换后的灰度值存贮在一个矩阵,便于以后计算。由于对bmp 和Delphi不太懂,所以
不知道问题所在。能不能提出解决问题的新方法?如读文件式等?
with message 'AccessViolation at address 00404AA5 in module "MyProject.exe".Read of
address FFFFFFFF.Process stopped.Use Step or Run to continue.源程序是有关一个bmp图象
的灰度值存储的,如下:procedure TMainForm.FileInput_bitmapClick(Sender: TObject);
var
pByteArray;
LastArray:array of array of byte;
Image_Name:String;
i,j,k:Integer;
begin
OpenPictureDialog1.Filter:='BitMap(*.bmp)|*.bmp';
if OpenPictureDialog1.Execute then
Image_Name:= OpenPictureDialog1.FileName;
Image1.Picture.LoadFromFile(Image_Name);
Image1.Picture.Bitmap.pixelformat := pf24bit;
SetLength(LastArray,Image1.Picture.bitmap.Height-1);//**
for i:=0 to Image1.Picture.bitmap.Height-1do
//**
SetLength(LastArray,Image1.Picture.bitmap.Width-1);//**
for i:=0 to Image1.Picture.bitmap.Height-1do
begin
//**
P:=Image1.Picture.BitMap.ScanLine;
//**
for j:=0 to Image1.Picture.bitmap.Width-1do
begin
k:=P[3*j]*28+P[j*3+1]*151+P[j*3+2]*77;
k:=k shr 6;
LastArray[i,j]:=byte(k);
end;
end;
end;
我想把转换后的灰度值存贮在一个矩阵,便于以后计算。由于对bmp 和Delphi不太懂,所以
不知道问题所在。能不能提出解决问题的新方法?如读文件式等?