zw版【转发·*nvp系列例程】HALCON ShapeTrans(Delphi)

时间:2022-07-08 15:19:09

zw版【转发·*nvp系列例程】HALCON ShapeTrans(Delphi)

zw版【转发·*nvp系列例程】HALCON ShapeTrans(Delphi)
procedure TForm1.Button1Click(Sender: TObject);
var
img: HImageX;
w, h: OleVariant;
rg, rg1: HRegionX;
begin
img := CoHImageX.Create;
img.ReadImage('razors1');
w := img.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowXCtrl1.HalconWindow);
rg := img.Threshold(100, 255);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
rg.DispObj(HWindowXCtrl2.HalconWindow);
rg1 := rg.MirrorRegion('row', h);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, h - 1, w - 1);
rg1.DispObj(HWindowXCtrl3.HalconWindow);
rg1 := rg.MirrorRegion('column', w);
HWindowXCtrl4.HalconWindow.SetPart(0, 0, h - 1, w - 1);
rg1.DispObj(HWindowXCtrl4.HalconWindow);
rg1 := rg.MirrorRegion('row', h / 2);
HWindowXCtrl5.HalconWindow.SetPart(0, 0, h - 1, w - 1);
rg1.DispObj(HWindowXCtrl5.HalconWindow);
rg1 := rg.MirrorRegion('column', w / 2);
HWindowXCtrl6.HalconWindow.SetPart(0, 0, h - 1, w - 1);
rg1.DispObj(HWindowXCtrl6.HalconWindow);
img := nil;
end;