zw版【转发·台湾nvp系列Delphi例程】CheckDifference1
zw版【转发·台湾nvp系列Delphi例程】CheckDifference1
procedure TForm1.Button1Click(Sender: TObject);
var
img, img1 : HImageX;
img2 : IHRegionX;
w , h : OleVariant;
mtype : OleVariant;
begin
img := CoHImageX.Create;
img.ReadImage('razors1');
img.GetImagePointer1(mtype, w, h);
HWindowX1.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowX1);
img1 := CoHImageX.Create;
img1.ReadImage('razors2');
HWindowX2.SetPart(0, 0, h - 1, w - 1);
img1.DispObj(HWindowX2);
img2 := img.CheckDifference(img1, 'diff_inside', 0, 0, 0, 0, 0);
HWindowX3.SetPart(0, 0, h - 1, w - 1);
img2.DispObj(HWindowX3);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
op.CloseWindow(HWindowX1.HalconID);
op.CloseWindow(HWindowX2.HalconID);
op.CloseWindow(HWindowX3.HalconID);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
ShowMessage('Delphi '+ IntToStr(Sizeof(Pointer)*8));
op := CoHOperatorSetX.Create;
op.SetCheck('~father');
HWindowX1 := CoHWindowX.Create();
HWindowX2 := CoHWindowX.Create();
HWindowX3 := CoHWindowX.Create();
HWindowX1.OpenWindow(0,0,Panel1.ClientWidth,Panel1.ClientHeight,Int64(Panel1.Handle),'visible','');
HWindowX2.OpenWindow(0,0,Panel2.ClientWidth,Panel2.ClientHeight,Int64(Panel2.Handle),'visible','');
HWindowX3.OpenWindow(0,0,Panel3.ClientWidth,Panel3.ClientHeight,Int64(Panel3.Handle),'visible','');
end;