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

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

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

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

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;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
img : HImageX;
rg : HRegionX;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
HomMat2D : HHomMat2DX;
begin
HomMat2D := CoHHomMat2DX.Create;
HomMat2D.HomMat2dIdentity;
HomMat2D := HomMat2D.HomMat2dRotate(Pi / 4, 250, 250);
rg := rg.AffineTransRegion(HomMat2D, 'nearest_neighbor');
HWindowXCtrl1.HalconWindow.ClearWindow;
img.DispObj(HWindowXCtrl1.HalconWindow);
rg.DispObj(HWindowXCtrl1.HalconWindow);
end;
procedure TForm1.FormShow(Sender: TObject);
var
w, h : OleVariant;
begin
img := CoHImageX.Create;
rg := CoHRegionX.Create;
img.ReadImage('ic0');
w := img.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
HWindowXCtrl1.HalconWindow.SetDraw('margin');
HWindowXCtrl1.HalconWindow.SetLineWidth(2);
HWindowXCtrl1.HalconWindow.SetColor('red');
rg.GenRectangle1(150, 150, 349, 349);
img.DispObj(HWindowXCtrl1.HalconWindow);
rg.DispObj(HWindowXCtrl1.HalconWindow);
end;
end.

上一篇:CentOS7 安装 MySQL


下一篇:Java中内存空间的分配及回收