zw版【转发·台湾nvp系列Delphi例程】HALCON ZoomImageFactor2
procedure TForm1.Button1Click(Sender: TObject);
var
op : HOperatorSetX;
image0, result1, result2 : HUntypedObjectX;
w, h : OleVariant;
begin
op := CoHOperatorSetX.Create;
op.ReadImage(image0, ‘engraved‘);
op.GetImageSize(image0, w, h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
image0.DispObj(HWindowXCtrl1.HalconWindow);
op.ZoomImageFactor(image0, result1, 0.5, 0.5, ‘constant‘);
op.GetImageSize(result1, w, h);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
result1.DispObj(HWindowXCtrl2.HalconWindow);
op.ZoomImageFactor(image0, result2, 0.5, 0.5, ‘weighted‘);
op.GetImageSize(result2, w, h);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, h - 1, w - 1);
result2.DispObj(HWindowXCtrl3.HalconWindow);
op.ClearObj(image0);
op.ClearObj(result1);
op.ClearObj(result2);
end;