写了以下这个简单的函数: procedure TForm1.Button1Click(Sender: TObject); var Bmp:TBitmap; FingerPrintRect:TRect; I,J:Integer; begin Bmp:=TBitmap.Create(); try Bmp.LoadFromFile('k:\zhiwen.bmp'); FingerPrintRect.Left:=Bmp.Width; FingerPrintRect.Right:=0; FingerPrintRect.Top:=Bmp.Height; FingerPrintRect.Bottom:=0; for J:=0 to Bmp.Height-1 do begin for I:=0 to Bmp.Width-1 do begin if Bmp.Canvas.Pixels[I,J]<RGB(100,100,100) then begin if I<FingerPrintRect.Left then begin FingerPrintRect.Left:=I; end; if J<FingerPrintRect.Top then begin FingerPrintRect.Top:=J; end; if I>FingerPrintRect.Right then begin FingerPrintRect.Right:=I; end; if J>FingerPrintRect.Bottom then begin FingerPrintRect.Bottom:=J; end; end else begin end; end; end; Bmp.Canvas.DrawFocusRect(FingerPrintRect); Image1.Picture.Bitmap.Assign(Bmp); finally Bmp.Free; end; end;但是由于你给的图像的右下脚有一个深色点,所以程序错误的把那里作为右边界了,如果希望得到比较正确的边界,可以尝试先对图像做一遍去噪声的操作,把噪声点去除。。 另外这里所使用的阈值颜色RGB(100,100,100)是一个经验值,根据你拍摄照片当时的光线以及CCD当时的对比度设置,这个值是不确定的。 指纹识别是个大课题,希望你还是看看数字图像处理,有好多东西要学呢。。 如果还有问题可以到这里直接找我: http://www.tonixsoft.com/phpbb2
procedure TForm1.Button1Click(Sender: TObject);
var
Bmp:TBitmap;
FingerPrintRect:TRect;
I,J:Integer;
begin
Bmp:=TBitmap.Create();
try
Bmp.LoadFromFile('k:\zhiwen.bmp');
FingerPrintRect.Left:=Bmp.Width;
FingerPrintRect.Right:=0;
FingerPrintRect.Top:=Bmp.Height;
FingerPrintRect.Bottom:=0;
for J:=0 to Bmp.Height-1 do begin
for I:=0 to Bmp.Width-1 do begin
if Bmp.Canvas.Pixels[I,J]<RGB(100,100,100) then begin
if I<FingerPrintRect.Left then begin
FingerPrintRect.Left:=I;
end;
if J<FingerPrintRect.Top then begin
FingerPrintRect.Top:=J;
end;
if I>FingerPrintRect.Right then begin
FingerPrintRect.Right:=I;
end;
if J>FingerPrintRect.Bottom then begin
FingerPrintRect.Bottom:=J;
end;
end
else begin
end;
end;
end; Bmp.Canvas.DrawFocusRect(FingerPrintRect);
Image1.Picture.Bitmap.Assign(Bmp);
finally
Bmp.Free;
end;
end;但是由于你给的图像的右下脚有一个深色点,所以程序错误的把那里作为右边界了,如果希望得到比较正确的边界,可以尝试先对图像做一遍去噪声的操作,把噪声点去除。。
另外这里所使用的阈值颜色RGB(100,100,100)是一个经验值,根据你拍摄照片当时的光线以及CCD当时的对比度设置,这个值是不确定的。
指纹识别是个大课题,希望你还是看看数字图像处理,有好多东西要学呢。。
如果还有问题可以到这里直接找我:
http://www.tonixsoft.com/phpbb2