Commit e5aaae14 LN

Merge branch 'master' of https://gitee.com/sunky045/AccAOI

2 个父辈 f2064c27 286377ea
...@@ -29,7 +29,7 @@ namespace AOI ...@@ -29,7 +29,7 @@ namespace AOI
/// </summary> /// </summary>
public Dictionary<string, AoiMethod> methodMap = new Dictionary<string, AoiMethod>(); public Dictionary<string, AoiMethod> methodMap = new Dictionary<string, AoiMethod>();
public List<ResultBean> CheckAll(Image image) public List<ResultBean> CheckAll(Image image, out Image resultImg)
{ {
//如果设置了校准方法,先校准图片 //如果设置了校准方法,先校准图片
var markMethodMap = methodMap.Where(kv=>kv.Value is AoiMarkMethod); var markMethodMap = methodMap.Where(kv=>kv.Value is AoiMarkMethod);
...@@ -42,8 +42,6 @@ namespace AOI ...@@ -42,8 +42,6 @@ namespace AOI
image = resultBean.currentRoiImage; image = resultBean.currentRoiImage;
} }
} }
List<ResultBean> resultBeans = new List<ResultBean>(); List<ResultBean> resultBeans = new List<ResultBean>();
foreach(var item in methodMap) foreach(var item in methodMap)
{ {
...@@ -55,11 +53,24 @@ namespace AOI ...@@ -55,11 +53,24 @@ namespace AOI
else else
{ {
ResultBean resultBean = method.Check(standardImage, image); ResultBean resultBean = method.Check(standardImage, image);
resultBean.roiPath = method.RoiPath;
resultBean.labelKey = item.Key; resultBean.labelKey = item.Key;
resultBeans.Add(resultBean); resultBeans.Add(resultBean);
} }
} }
using (Graphics g = Graphics.FromImage(image))
{
foreach(ResultBean resultBean in resultBeans)
{
Pen pen = new Pen(Color.Green);
if (!resultBean.result)
{
pen = new Pen(Color.Red);
}
g.DrawPath(pen,resultBean.roiPath);
}
}
resultImg = image;
return resultBeans; return resultBeans;
} }
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -22,5 +23,7 @@ namespace AOI ...@@ -22,5 +23,7 @@ namespace AOI
public Image currentRoiImage; public Image currentRoiImage;
public GraphicsPath roiPath;
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!