zw版【转发·*nvp系列Delphi例程】HALCON FastThreshold1
procedure TForm1.Button1Click(Sender: TObject);
var
img : HImageX;
rg : HRegionX;
w, h : OleVariant;
begin
img := CoHImageX.Create;
img.ReadImage('bga_14x14_defects');
w := img.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowXCtrl1.HalconWindow);
rg := img.FastThreshold(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);
end;