zw版【转发·台湾nvp系列Delphi例程】HALCON max_connection
2015-10-01 15:32
483 查看
zw版【转发·台湾nvp系列Delphi例程】HALCON max_connection
![](http://images2015.cnblogs.com/blog/58589/201510/58589-20151001153115558-1649566060.png)
procedure TForm1.Button1Click(Sender: TObject);
var
ho_Image : HImageX;
sys : HSystemX;
ho_Region : HRegionX;
hv_Information : OleVariant;
ho_ConnectedRegions, ho_ConnectedRegionsMax : HRegionX;
hv_NumConnected, hv_NumConnectedMax : Longint;
w, h : OleVariant;
begin
ho_Image := CoHImageX.Create;
ho_Image.ReadImage('monkey');
w := ho_Image.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_Image.DispObj(HWindowXCtrl1.HalconWindow);
sys := CoHSystemX.Create;
hv_Information := sys.GetSystem('max_connection');
ho_Region := ho_Image.Threshold(128, 255);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_Region.DispObj(HWindowXCtrl2.HalconWindow);
sys.SetSystem('max_connection', 0);
ho_ConnectedRegions := ho_Region.Connection;
hv_NumConnected := ho_ConnectedRegions.CountObj;
HWindowXCtrl3.HalconWindow.SetColored(12);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_ConnectedRegions.DispObj(HWindowXCtrl3.HalconWindow);
set_display_font(HWindowXCtrl3.HalconWindow.HalconID, 16, 'mono', 'true', 'false');
disp_message(HWindowXCtrl3.HalconWindow.HalconID, VarToStr(hv_NumConnected), 'window', 10, 10, 'black', 'true');
sys.SetSystem('max_connection', 1000);
ho_ConnectedRegionsMax := ho_Region.Connection;
hv_NumConnectedMax := ho_ConnectedRegionsMax.CountObj;
HWindowXCtrl4.HalconWindow.SetColored(12);
HWindowXCtrl4.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_ConnectedRegionsMax.DispObj(HWindowXCtrl4.HalconWindow);
set_display_font(HWindowXCtrl4.HalconWindow.HalconID, 16, 'mono', 'true', 'false');
disp_message(HWindowXCtrl4.HalconWindow.HalconID, VarToStr(hv_NumConnectedMax), 'window', 10, 10, 'black', 'true');
sys.SetSystem('max_connection', hv_Information);
end;
![](http://images2015.cnblogs.com/blog/58589/201510/58589-20151001153115558-1649566060.png)
procedure TForm1.Button1Click(Sender: TObject);
var
ho_Image : HImageX;
sys : HSystemX;
ho_Region : HRegionX;
hv_Information : OleVariant;
ho_ConnectedRegions, ho_ConnectedRegionsMax : HRegionX;
hv_NumConnected, hv_NumConnectedMax : Longint;
w, h : OleVariant;
begin
ho_Image := CoHImageX.Create;
ho_Image.ReadImage('monkey');
w := ho_Image.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_Image.DispObj(HWindowXCtrl1.HalconWindow);
sys := CoHSystemX.Create;
hv_Information := sys.GetSystem('max_connection');
ho_Region := ho_Image.Threshold(128, 255);
HWindowXCtrl2.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_Region.DispObj(HWindowXCtrl2.HalconWindow);
sys.SetSystem('max_connection', 0);
ho_ConnectedRegions := ho_Region.Connection;
hv_NumConnected := ho_ConnectedRegions.CountObj;
HWindowXCtrl3.HalconWindow.SetColored(12);
HWindowXCtrl3.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_ConnectedRegions.DispObj(HWindowXCtrl3.HalconWindow);
set_display_font(HWindowXCtrl3.HalconWindow.HalconID, 16, 'mono', 'true', 'false');
disp_message(HWindowXCtrl3.HalconWindow.HalconID, VarToStr(hv_NumConnected), 'window', 10, 10, 'black', 'true');
sys.SetSystem('max_connection', 1000);
ho_ConnectedRegionsMax := ho_Region.Connection;
hv_NumConnectedMax := ho_ConnectedRegionsMax.CountObj;
HWindowXCtrl4.HalconWindow.SetColored(12);
HWindowXCtrl4.HalconWindow.SetPart(0, 0, h - 1, w - 1);
ho_ConnectedRegionsMax.DispObj(HWindowXCtrl4.HalconWindow);
set_display_font(HWindowXCtrl4.HalconWindow.HalconID, 16, 'mono', 'true', 'false');
disp_message(HWindowXCtrl4.HalconWindow.HalconID, VarToStr(hv_NumConnectedMax), 'window', 10, 10, 'black', 'true');
sys.SetSystem('max_connection', hv_Information);
end;
相关文章推荐
- zw版【转发·台湾nvp系列Delphi例程】HALCON MirrorImage2
- zw版【转发·台湾nvp系列Delphi例程】HALCON MirrorImage
- zw版【转发·台湾nvp系列Delphi例程】HALCON MoveRectangle2
- zw版【转发·台湾nvp系列Delphi例程】HALCON MoveRectangle
- zw版【转发·台湾nvp系列Delphi例程】HALCON SetIcon1
- zw版【转发·台湾nvp系列Delphi例程】HALCON SetIcon2
- zw版【转发·台湾nvp系列Delphi例程】HALCON DispArc
- zw版【转发·台湾nvp系列Delphi例程】HALCON HSerializedItem
- zw版【转发·台湾nvp系列Delphi例程】HALCON union1
- zw版【转发·台湾nvp系列Delphi例程】HALCON SqrtImage
- zw版【转发·台湾nvp系列Delphi例程】HALCON SubImage
- zw版【转发·台湾nvp系列Delphi例程】HALCON SetWindowExtent
- zw版【转发·台湾nvp系列Delphi例程】HALCON TestSubsetRegio
- zw版【转发·台湾nvp系列Delphi例程】HALCON ClipRegion
- zw版【转发·台湾nvp系列Delphi例程】HALCON SetMshape
- zw版【转发·台湾nvp系列Delphi例程】HALCON SmoothImage
- zw版【转发·台湾nvp系列Delphi例程】HALCON SelectObj
- zw版【转发·台湾nvp系列例程】HALCON EquHistoImage(Delphi)
- zw版【转发·台湾nvp系列例程】HALCON ShapeTrans(Delphi)
- zw版【转发·台湾nvp系列例程】HALCON MirrorRegion (Delphi)