首页 > Windows开发 > 详细

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

时间:2015-10-01 17:48:56      阅读:439      评论:0      收藏:0      [点我收藏+]

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

 

 技术分享

SetGray_Delphi.PNG

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);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
img : HImageX;
rg, Circles : HRegionX;
tp : HTupleX;
w, h : OleVariant;
Row, Column, Radius : OleVariant;
begin
img := CoHImageX.Create;
Circles := CoHRegionX.Create;
tp := CoHTupleX.Create;
img.ReadImage(‘pads‘);
rg := img.Regiongrowing(3, 3, 6, 100);
rg := rg.SelectShape(‘area‘, ‘and‘, 100, 2000);
Row := rg.SmallestCircle(Column, Radius);
Circles.GenCircle(Row, Column, Radius);
w := img.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
HWindowXCtrl1.HalconWindow.SetDraw(‘margin‘);
HWindowXCtrl1.HalconWindow.SetLineWidth(2);
HWindowXCtrl1.HalconWindow.SetGray(tp.TupleConcat(tp.TupleConcat(0, 120), 255));
img.DispObj(HWindowXCtrl1.HalconWindow);
Circles.DispObj(HWindowXCtrl1.HalconWindow);
end;
end.

 

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

原文:http://www.cnblogs.com/ziwang/p/4851177.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!