老
老在门外
Unregistered / Unconfirmed
GUEST, unregistred user!
function pictobmp(ojpg:string):tbitmap;//转换成BMP
var
jpgimage:tjpegimage;
begin
jpgimage:=tjpegimage.Create;
jpgimage.LoadFromFile(ojpg);
result:=tbitmap.Create;
result.Assign(jpgimage);
jpgimage.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i,j,f,rr,gg,bb:integer;
q1,q:single;
a,a1:single;
Aarray:array of extended;
begin
if opendialog1.Execute then//获取HSI中的H
begin
obmp1:=tbitmap.Create;
obmp1:=pictobmp(opendialog1.FileName);
image1.Picture.Bitmap:=obmp1;
f:=0;
setlength(Aarray,image1.Width*image1.Height);
for i:=0 to image1.Width-1 do
for j:=0 to image1.Height-1 do
begin
rr:=getrvalue(image1.Canvas.Pixels[i,j]);
gg:=getgvalue(image1.Canvas.Pixels[i,j]);
bb:=getbvalue(image1.Canvas.Pixels[i,j]);
a:=0.5*((rr-gg)+(rr-bb));
a1:=sqrt((rr-gg)*(rr-gg)+(rr-bb)*(gg-bb));
q1:=a/a1;/(在这里出了错误)
q:=arccos(q1);
if rr>=bb then
Aarray[f]:=q
else
Aarray[f]:=2*pi-q;
f:=f+1;
end;
end;
错误提示:Project project1.exe raised exception class EInvalidOP with messaage
'Invalid floating point operation' process stopped.Use step or Run to continue