zw版【转发· 台@@湾 nvp系列Delphi例程】HALCON CheckDifference
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, HALCONXLib_TLB; type TForm1 = class(TForm) HWindowXCtrl1: THWindowXCtrl; Button1: TButton; HWindowXCtrl2: THWindowXCtrl; HWindowXCtrl3: THWindowXCtrl; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var img0, img1 : HImageX; result : HRegionX; w, h : OleVariant; mtype : OleVariant; begin img0 := CoHImageX.Create; img0.ReadImage('razors1'); img0.GetImagePointer1(mtype, w, h); HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1); img0.DispObj(HWindowXCtrl1.HalconWindow); img1 := CoHImageX.Create; img1.ReadImage('razors2'); img1.GetImagePointer1(mtype, w, h); HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1); img1.DispObj(HWindowXCtrl2.HalconWindow); result := img0.CheckDifference(img1, 'diff_inside', 0, 0, 0, 0, 0); HWindowXCtrl3.HalconWindow.SetPart(0, 0, h - 1, w - 1); result.DispObj(HWindowXCtrl3.HalconWindow); end; end.
|
请发表评论