zw版【转发·*nvp系列Delphi例程】HALCON TestRegionPoint2
procedure TForm1.Button1Click(Sender: TObject);
var
op : HOperatorSetX;
img : HUntypedObjectX;
rg : HUntypedObjectX;
w , h : OleVariant;
rest : OleVariant;
begin
op := CoHOperatorSetX.Create;
op.ReadImage(img, 'bga_14x14_defects');
op.GetImageSize(img, w, h);
HWindowXCtrl1.HalconWindow.SetDraw('margin');
HWindowXCtrl1.HalconWindow.SetColor('red');
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
op.DispObj(img, HWindowXCtrl1.HalconWindow.HalconID);
op.FastThreshold(img, rg, 0, 120, 20);
op.DispObj(rg, HWindowXCtrl1.HalconWindow.HalconID);
op.TestRegionPoint(rg, 76, 360, rest);
Label2.Caption := '(76, 360) - ' + VarToStr(rest);
op.TestRegionPoint(rg, 77, 360, rest);
Label3.Caption := '(77, 360) - ' + VarToStr(rest);
end;