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

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

 

procedure TForm1.Button1Click(Sender: TObject);
var
op: HOperatorSetX;
img, img1: HUntypedObjectX;
w, h: OleVariant;
rg: HUntypedObjectX;
begin
op := CoHOperatorSetX.Create;
op.ReadImage(img, 'clip');
op.GetImageSize(img, w, h);
HWindowX1.SetPart(0, 0, h - 1, w - 1);
img.DispObj(HWindowX1);
op.Roberts(img, img1, 'roberts_max');
op.Threshold(img1, rg, 50, 150);
HWindowX2.SetPart(0, 0, h - 1, w - 1);
HWindowX2.SetColor('white');
HWindowX2.SetDraw('margin');
img1.DispObj(HWindowX2);
rg.DispObj(HWindowX2);
HWindowX2.SetColor('red');
HWindowX2.SetTposition(10, 10);
HWindowX2.WriteString('roberts_max');
op.Roberts(img, img1, 'gradient_max');
op.Threshold(img1, rg, 50, 150);
HWindowX3.SetPart(0, 0, h - 1, w - 1);
HWindowX3.SetColor('white');
HWindowX3.SetDraw('margin');
img1.DispObj(HWindowX3);
rg.DispObj(HWindowX3);
HWindowX3.SetColor('red');
HWindowX3.SetTposition(10, 10);
HWindowX3.WriteString('gradient_max');
op.Roberts(img, img1, 'gradient_sum');
op.Threshold(img1, rg, 50, 150);
HWindowX4.SetPart(0, 0, h - 1, w - 1);
HWindowX4.SetColor('white');
HWindowX4.SetDraw('margin');
img1.DispObj(HWindowX4);
rg.DispObj(HWindowX4);
HWindowX4.SetColor('red');
HWindowX4.SetTposition(10, 10);
HWindowX4.WriteString('gradient_sum');
end;

posted @ 2015-10-01 15:35  统领  阅读(313)  评论(0编辑  收藏  举报