zw版【转发·台湾nvp系列Delphi例程】HALCON InpaintingCt2
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
op : HOperatorSetX;
ho_Image : HUntypedObjectX;
ho_Region : HUntypedObjectX;
ho_InpaintedImage : HUntypedObjectX;
hv_Width, hv_Height : OleVariant;
begin
op := CoHOperatorSetX.Create();
op.GenEmptyObj(ho_Image);
op.ReadImage(ho_Image, ‘lynx‘);
op.GetImageSize(ho_Image, hv_Width, hv_Height);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, hv_Height - 1, hv_Width- 1);
op.DispObj(ho_Image, HWindowXCtrl1.HalconWindow.HalconID);
op.GenEmptyObj(ho_Region);
op.ReadRegion(ho_Region, ‘lynx_mask‘);
HWindowXCtrl2.HalconWindow.SetColor(‘blue‘);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, hv_Height - 1, hv_Width- 1);
op.DispObj(ho_Region, HWindowXCtrl2.HalconWindow.HalconID);
op.InpaintingCt(ho_Image, ho_Region, ho_InpaintedImage,13, 70, 1.2, 4, 1);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, hv_Height - 1, hv_Width - 1);
op.DispObj(ho_InpaintedImage, HWindowXCtrl3.HalconWindow.HalconID);
end;
end.