zw版【转发·台湾nvp系列Delphi例程】HALCON TestSubsetRegio

zw版【转发·台湾nvp系列Delphi例程】HALCON TestSubsetRegio-LMLPHP

procedure TForm1.Button1Click(Sender: TObject);
var
rg0 : array[0..1] of HRegionX;
rg1 : array[0..1] of HRegionX;
win : HWindowX;
i : Integer;
img : HImageX;
sys : HSystemX;
IsSubset : OleVariant;
w, h : OleVariant;
ht : HTupleX;
begin
sys := CoHSystemX.Create;
sys.SetSystem('clip_region', 'false');
ht := CoHTupleX.Create;
img := CoHImageX.Create;
img.ReadImage('meningg6');
w := img.GetImageSize(h);
win := HWindowXCtrl1.HalconWindow;
win.SetPart(0, 0, h - 1, w - 1);
win.SetDraw('margin');
win.SetColored(12);
win.ClearWindow;
for i := 0 to 1 do
begin
rg0 := CoHRegionX.Create;
rg1 := CoHRegionX.Create;
end;
rg0[0].GenRectangle1(80, 200, 150, 400);
rg0[1].GenCircle(300, 300, 100);
rg1[0].GenRectangle1(100, 250, 120, 350);
rg1[1].GenCircle(350, 350, 60);
rg0[0] := rg0[0].ConcatObj(rg0[1]);
rg1[0] := rg1[0].ConcatObj(rg1[1]);

img.DispObj(win);
rg0[0].DispObj(win);
rg1[0].DispObj(win);
win.SetColor('white');
IsSubset := rg1[0].TestSubsetRegion(rg0[0]);
for i := 0 to ht.TupleLength(IsSubset) - 1 do
begin
win.SetTposition(30 * i, 10);
win.WriteString(ht.TupleSelect(IsSubset, i));
end;
end;

05-11 17:30