zw版【转发·台湾nvp系列Delphi例程】HALCON FastThreshold2
FastThreshold_Delphi_2.PNG
procedure TForm1.Button1Click(Sender: TObject);
var
op : HOperatorSetX;
img : HUntypedObjectX;
rg : HUntypedObjectX;
w, h : OleVariant;
begin
op := CoHOperatorSetX.Create;
op.ReadImage(img, 'bga_14x14_defects');
op.GetImageSize(img, w, h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowXCtrl1.HalconWindow);
op.FastThreshold(img, rg, 0, 120, 20);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowXCtrl2.HalconWindow);
HWindowXCtrl2.HalconWindow.SetDraw('margin');
HWindowXCtrl2.HalconWindow.SetColor('red');
rg.DispObj(HWindowXCtrl2.HalconWindow);
op.ClearObj(img);
op.ClearObj(rg);
end;