标签:
zw版【转发·台湾nvp系列Delphi例程】HALCON GenGridRegion
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;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
image : HImageX;
Raster : HRegionX;
w, h : OleVariant;
begin
//lines
image := CoHImageX.Create;
image.ReadImage(‘ic0‘);
w := image.GetImageSize(h);
Raster := CoHRegionX.Create;
Raster.GenGridRegion(20, 20, ‘lines‘, w, h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
HWindowXCtrl1.HalconWindow.SetLineWidth(1);
HWindowXCtrl1.HalconWindow.SetDraw(‘margin‘);
HWindowXCtrl1.HalconWindow.SetColor(‘red‘);
image.DispObj(HWindowXCtrl1.HalconWindow);
Raster.DispObj(HWindowXCtrl1.HalconWindow);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
image : HImageX;
Raster : HRegionX;
w, h : OleVariant;
begin
//points
image := CoHImageX.Create;
image.ReadImage(‘ic0‘);
w := image.GetImageSize(h);
Raster := CoHRegionX.Create;
Raster.GenGridRegion(20, 20, ‘points‘, w, h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
HWindowXCtrl1.HalconWindow.SetLineWidth(3);
HWindowXCtrl1.HalconWindow.SetDraw(‘margin‘);
HWindowXCtrl1.HalconWindow.SetColor(‘red‘);
image.DispObj(HWindowXCtrl1.HalconWindow);
Raster.DispObj(HWindowXCtrl1.HalconWindow);
end;
end.
zw版【转发·台湾nvp系列Delphi例程】HALCON GenGridRegion
标签:
原文地址:http://www.cnblogs.com/ziwang/p/4851204.html