zw版【转发·台湾nvp系列Delphi例程】HALCON ConvolImage
procedure TForm1.Button1Click(Sender: TObject);
begin
img.DispObj(win);
sys.WaitSeconds(1);
win.DispObj(img.ConvolImage(‘sobel‘, ‘mirrored‘) as IHObjectX);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
sys := CoHSystemX.Create;
win := HWindowXCtrl1.HalconWindow;
img := CoHImageX.Create;
img.ReadImage(‘fabrik.png‘);
w := img.GetImageSize(h);
win.SetPart(0, 0, h - 1, w - 1);
img.DispObj(win);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
FilterMask : OleVariant;
begin
img.DispObj(win);
sys.WaitSeconds(1);
FilterMask := VarArrayOf([3, 3, -1, 1, 2, 1, 0, 0, 0, -1, -2, -1]);
win.DispObj(img.ConvolImage(FilterMask, ‘mirrored‘) as IHObjectX);
sys.WaitSeconds(1);
FilterMask := VarArrayOf([3, 3, -1, 1, 0, -1, 2, 0, -2, 1, 0, -1]);
win.DispObj(img.ConvolImage(FilterMask, ‘mirrored‘) as IHObjectX);
end;