赞
踩
查看边界属性信息
- //1.code
- CogGraphicLabel myLabel = new CogGraphicLabel();//图形标签
- CogGraphicCollection gc = new CogGraphicCollection();//图形集合
-
-
-
-
-
- //2.code
- //2.1获取blob工具
- CogBlobTool blob = mToolBlock.Tools["CogBlobTool1"] as CogBlobTool;
- //根据结果数 显示结果
- myLabel.BackgroundColor = CogColorConstants.Orange;
- if (blob.Results.GetBlobs().Count > 0)
- {
- myLabel.SetXYText(100, 20, "NOT OK");
- myLabel.Color = CogColorConstants.Red;
- }
- else
- {
- myLabel.SetXYText(100, 20, "OK");
- myLabel.Color = CogColorConstants.Green;
- }
- //遍历结果获取边界
- gc.Clear();
- foreach( CogBlobResult b in blob.Results.GetBlobs() )
- {
- CogPolygon p = b.GetBoundary(); //每个斑点的边界 多边形对象
- p.Color = CogColorConstants.Red; // 修改着色
- gc.Add(p);
- }
-
-
-
-
- //3.code
- mToolBlock.AddGraphicToRunRecord(myLabel, lastRecord, "CogBlobTool1.InputImage", "");
- //添加红色边界
- foreach( ICogGraphic c in gc )
- {
- mToolBlock.AddGraphicToRunRecord(c, lastRecord, "CogBlobTool1.InputImage", "");
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。