zw版【转发·*nvp系列Delphi例程】HALCON AddNoiseWhite

时间:2022-01-05 00:15:58

zw版【转发·*nvp系列Delphi例程】HALCON AddNoiseWhite

zw版【转发·*nvp系列Delphi例程】HALCON AddNoiseWhite

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;
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;
w , h : OleVariant;
mtype : OleVariant;
begin
img := CoHImageX.Create;
img.ReadImage('fabrik');
img.GetImagePointer1(mtype, w, h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowXCtrl1.HalconWindow);
img := img.AddNoiseWhite(90);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowXCtrl2.HalconWindow);
end;
end.