码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2015-10-01 17:47:40      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:

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.

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

标签:

原文地址:http://www.cnblogs.com/ziwang/p/4851197.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!