Commit c8488e39 SK

检测所有时输出结果图片

1 个父辈 b4bf8113
......@@ -29,7 +29,7 @@ namespace AOI
/// </summary>
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);
......@@ -42,8 +42,6 @@ namespace AOI
image = resultBean.currentRoiImage;
}
}
List<ResultBean> resultBeans = new List<ResultBean>();
foreach(var item in methodMap)
{
......@@ -55,11 +53,24 @@ namespace AOI
else
{
ResultBean resultBean = method.Check(standardImage, image);
resultBean.roiPath = method.RoiPath;
resultBean.labelKey = item.Key;
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;
}
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -22,5 +23,7 @@ namespace AOI
public Image currentRoiImage;
public GraphicsPath roiPath;
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!