zw版【转发·*nvp系列Delphi例程】HALCON CheckDifference

zw版【转发·*nvp系列Delphi例程】HALCON CheckDifference

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.

上一篇:HDU2841 Visible Trees(容斥原理)


下一篇:C#中调用Matlab人工神经网络算法实现手写数字识别