zw版【转发·*nvp系列Delphi例程】HALCON DivImage1
procedure TForm1.Button1Click(Sender: TObject);
var
img0, img1, result : HImageX;
w, h : OleVariant;
begin
img0 := CoHImageX.Create;
img0.ReadImage('traffic1');
w := img0.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img0.DispObj(HWindowXCtrl1.HalconWindow);
img1 := CoHImageX.Create;
img1.ReadImage('traffic2');
w := img1.GetImageSize(h);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img1.DispObj(HWindowXCtrl2.HalconWindow);
result := img0.DivImage(img1, 255, 0);
w := result.GetImageSize(h);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, h - 1, w - 1);
result.DispObj(HWindowXCtrl3.HalconWindow);
end;