zw版【转发·台湾nvp系列Delphi例程】HALCON FillUpShape2
procedure TForm1.Button1Click(Sender: TObject);
var
op : HOperatorSetX;
img : HUntypedObjectX;
rg, rg1 : HUntypedObjectX;
w, h : OleVariant;
begin
op := CoHOperatorSetX.Create;
op.ReadImage(img, ‘tooth_rim‘);
op.GetImageSize(img, w, h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
op.DispObj(img, HWindowXCtrl1.HalconWindow.HalconID);
op.Threshold(img, rg, 0, 80);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
op.DispObj(rg, HWindowXCtrl2.HalconWindow.HalconID);
op.FillUpShape(rg, rg1, ‘area‘, 200, 1000);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, h - 1, w - 1);
op.DispObj(rg1, HWindowXCtrl3.HalconWindow.HalconID);
end;
时间: 2024-10-19 21:49:00