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

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


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
ho_Image : HImageX;
hv_Width, hv_Height : OleVariant;
ho_Region : HRegionX;
ho_InpaintedImage : HImageX;
begin
ho_Image := CoHImageX.Create();
ho_Image.ReadImage('lynx');
hv_Width := ho_Image.GetImageSize(hv_Height);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, hv_Height - 1, hv_Width - 1);
ho_Image.DispObj(HWindowXCtrl1.HalconWindow);
ho_Region := coHRegionX.Create();
ho_Region.ReadRegion('lynx_mask');
HWindowXCtrl2.HalconWindow.SetColor('blue');
HWindowXCtrl2.HalconWindow.SetPart(0, 0, hv_Height - 1, hv_Width- 1);
ho_Region.DispObj(HWindowXCtrl2.HalconWindow);
ho_InpaintedImage := ho_Image.InpaintingCt(ho_Region, 13, 70, 1.2, 4, 1);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, hv_Height - 1, hv_Width- 1);
ho_InpaintedImage.DispObj(HWindowXCtrl3.HalconWindow);
end;
end.

posted @ 2015-10-01 16:52  统领  阅读(375)  评论(0编辑  收藏  举报