用scanline好了,速度很快的,至于算子有很多,我就用标准算子把,下面的例子是MDI的
自己改一下就可以了,good luck!
procedure TMainForm.normalsharpClick(Sender: TObject);
var
bmp1,bmp2:Tbitmap;
p1,p2,p3,p4
bytearray;
i,j: integer;
begin
bmp1:=Tbitmap.Create;
bmp2:=Tbitmap.Create;
bmp1.Assign(ChildForm.image1.Picture.Bitmap);
bmp1.PixelFormat:=pf24bit;
bmp1.Width:=ChildForm.image1.Picture.Graphic.Width;
bmp1.Height:=ChildForm.image1.Picture.Graphic.Height;
bmp2.Assign(ChildForm.image1.Picture.Bitmap);
bmp2.PixelFormat:=pf24bit;
for j:=1 to bmp1.Height-2 do
begin
p1:=bmp1.ScanLine[j];
p2:=bmp2.ScanLine[j-1];
p3:=bmp2.ScanLine[j];
p4:=bmp2.ScanLine[j+1];
for i:=1 to bmp1.Width-2 do
begin
p1[3*i+2]:=min(255,max(0,((-p2[3*(i-1)+2]-p2[3*i+2]-p2[3*(i+1)+2]-p3[3*(i-1)+2]+16*p3[3*i+2]-p3[3*(i+1)+2]-p4[3*(i-1)+2]-p4[3*i+2]-p4[3*(i+1)+2]) div 8 )));
p1[3*i+1]:= min(255,max(0,((-p2[3*(i-1)+1]-p2[3*i+1]-p2[3*(i+1)+1]-p3[3*(i-1)+1]+16*p3[3*i+1]-p3[3*(i+1)+1]-p4[3*(i-1)+1]-p4[3*i+1]-p4[3*(i+1)+1])div 8)));
p1[3*i]:= min(255,max(0,((-p2[3*(i-1)]-p2[3*i]-p2[3*(i+1)]-p3[3*(i-1)]+16*p3[3*i]-p3[3*(i+1)]-p4[3*(i-1)]-p4[3*i]-p4[3*(i+1)])div 8)));
end;
end;
ChildForm.Image1.Picture.Bitmap.Assign(Bmp1);
Bmp1.Free;
bmp2.Free;
end;