Commit 083ce221 刘韬

1

1 个父辈 b5f79fff
......@@ -24,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
......@@ -34,6 +35,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
......@@ -52,6 +56,10 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......@@ -61,6 +69,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AoiProject.cs" />
<Compile Include="eyemlib\AoiEyemMarkMethod.cs" />
<Compile Include="eyemlib\AoiEyemTemplateMethod.cs" />
<Compile Include="eyemlib\Eyemlib.cs" />
<Compile Include="match\AoiColorMatchMethod.cs" />
<Compile Include="match\AoiTemplateMethod.cs" />
<Compile Include="util\Base64Util.cs" />
......@@ -76,7 +87,6 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
......
......@@ -17,6 +17,11 @@ namespace AOI
//public string PathDatas { get; set; }
public string MethodName { get; set; }
public static float CenterOffsetX = 0;
public static float CenterOffsetY = 0;
/// <summary>
/// 兴趣区域路径
/// </summary>
......
......@@ -11,6 +11,7 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AOI
{
......@@ -20,15 +21,18 @@ namespace AOI
{
}
public AoiProject(Image theImage)
public AoiProject(Image theImage, Image OrgImage)
{
this.standardImage = theImage;
this.OrgImage = OrgImage;
}
public AoiMethod BaseROI = new AoiEyemMarkMethod();
/// <summary>
/// 标准的Image
/// </summary>
public Image standardImage { get; set; }
public Image OrgImage { get; set; }
public Eyemlib.EyemImage eyemTemplateImage { get; set; }
/// <summary>
/// 所有的AOI方法
/// </summary>
......@@ -37,7 +41,7 @@ namespace AOI
public List<ResultBean> CheckAll(Image scr, out Image resultImg)
{
// GC.Collect();
Image image =new Bitmap(scr);
Image image =Eyemlib.DeepClone(scr);
//如果设置了校准方法,先校准图片
var markMethodMap = methodMap.Where(kv=>kv.Value is AoiMarkMethod);
foreach (var item in markMethodMap)
......@@ -93,21 +97,30 @@ namespace AOI
Dictionary<string, string> projectMap = new Dictionary<string, string>();
// string base64ImgStr = Base64Util.ToBase64(this.standardImage);
// projectMap.Add("base64Img", base64ImgStr);
this.standardImage.Save(GetStandardImgPath(filePath), ImageFormat.Bmp);
//this.standardImage.Save(GetStandardImgPath(filePath), ImageFormat.Bmp);
this.OrgImage.Save(GetStandardImgPath(filePath), ImageFormat.Bmp);
var mapForJson = new Dictionary<string, string>();
foreach(var item in this.methodMap)
{
JObject obj = JObject.FromObject(item.Value);
obj.Add("FullTypeName",item.Value.GetType().FullName);
var roiPathData = item.Value.GetRoiPathData();
string roiPathDataStr = JsonUtil.SerializeObject(roiPathData);
obj.Add("PathDataStr", roiPathDataStr);
string jsonStr = JsonUtil.SerializeObject(obj);
mapForJson.Add(item.Key, jsonStr);
mapForJson.Add(item.Key, GetItemObj(item.Value));
}
string methodMapJson = JsonUtil.SerializeObject(mapForJson);
projectMap.Add("methodMap", methodMapJson);
projectMap.Add("BaseROI", GetItemObj(BaseROI));
JsonUtil.SerializeObjectToFile(projectMap,filePath,false);
string GetItemObj(AoiMethod itemv) {
JObject obj = JObject.FromObject(itemv);
obj.Add("FullTypeName", itemv.GetType().FullName);
var roiPathData = itemv.GetRoiPathData();
string roiPathDataStr = JsonUtil.SerializeObject(roiPathData);
obj.Add("PathDataStr", roiPathDataStr);
string jsonStr = JsonUtil.SerializeObject(obj);
return jsonStr;
}
}
private static string GetStandardImgPath(string filePath)
......@@ -136,9 +149,7 @@ namespace AOI
msg = "no image ";
return null;
}
Image image = Image.FromFile(imageFile);
aoiProject.standardImage = new Bitmap(image);
image.Dispose();
aoiProject.OrgImage = Eyemlib.DeepClone( new Bitmap(imageFile));
Dictionary<string, string> projectMap = JsonUtil.DeserializeJsonToObjectFromFile<Dictionary<string, string>>(filePath);
// string base64Img = projectMap["base64Img"];
......@@ -148,21 +159,15 @@ namespace AOI
var jsonMap = JsonUtil.DeserializeJsonToObject<Dictionary<string, string>>(methodMapJson);
foreach (var item in jsonMap)
{
JObject obj = JObject.Parse(item.Value);
string fullTypeName = obj.Value<string>("FullTypeName");
Type t = Type.GetType(fullTypeName);
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(item.Value);
object o = serializer.Deserialize(new JsonTextReader(sr), t);
AoiMethod aoiMethod = (AoiMethod)o;
string PathDataStr = obj.Value<string>("PathDataStr");
PathData pathData = JsonUtil.DeserializeJsonToObject<PathData>(PathDataStr);
if (pathData!=null && pathData.Points.Length>0)
aoiMethod.RoiPath = new GraphicsPath(pathData.Points, pathData.Types);
aoiProject.methodMap.Add(item.Key, aoiMethod);
aoiProject.methodMap.Add(item.Key, GetAOIFromJson(item.Value));
Thread.Sleep(1);
}
aoiProject.BaseROI = GetAOIFromJson(projectMap["BaseROI"]);
aoiProject.standardImage = aoiProject.ProcessBaseImage((Bitmap)aoiProject.OrgImage,"基准图");
return aoiProject;
}
catch (Exception ex)
......@@ -176,8 +181,41 @@ namespace AOI
return null;
}
AoiMethod GetAOIFromJson(string jsv)
{
JObject obj = JObject.Parse(jsv);
string fullTypeName = obj.Value<string>("FullTypeName");
Type t = Type.GetType(fullTypeName);
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(jsv);
object o = serializer.Deserialize(new JsonTextReader(sr), t);
AoiMethod aoiMethod = (AoiMethod)o;
string PathDataStr = obj.Value<string>("PathDataStr");
PathData pathData = JsonUtil.DeserializeJsonToObject<PathData>(PathDataStr);
if (pathData != null && pathData.Points.Length > 0)
aoiMethod.RoiPath = new GraphicsPath(pathData.Points, pathData.Types);
return aoiMethod;
}
}
public Bitmap ProcessBaseImage(Bitmap orgimage,string name)
{
var markroi = BaseROI;
if (markroi == null || markroi.RoiPath == null || markroi.RoiPath.GetBounds() == RectangleF.Empty)
{
return Eyemlib.DeepClone(orgimage);
}
else
{
var (BaseImg, EyemBaseImg, result) = Eyemlib.ExtractPCB(orgimage, markroi.RoiPath.GetBounds());
if (!result)
{
MessageBox.Show(name+"在框选区域内没有找到PCB");
}
return (Bitmap)BaseImg;
}
}
}
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using OpenCvSharp;
using OpenCvSharp.Blob;
using OpenCvSharp.XFeatures2D;
using static AOI.Eyemlib;
namespace AOI
{
/// <summary>
/// 模板匹配
/// </summary>
public class AoiEyemTemplateMethod : AoiMethod
{
/// <summary>
/// 相似度百分比
/// </summary>
public double SamePercent = 80;
public double AnglePercent = 180;
public override ResultBean Check(Image standardImage, Image imageToCheck)
{
ResultBean resultBean = new ResultBean(MethodName,4,SamePercent,SamePercent);
bool needCut = true;
Image standardRoiImg = GetRoiImage(standardImage, needCut);
resultBean.standardRoiImage = standardRoiImg;
double percent, angle;
(percent,angle) = GetTemplateMatchPercent(standardImage, imageToCheck, out Image cutImg);
bool result = false;
if(SamePercent > 100)
{
SamePercent = 100;
}
if(percent >= SamePercent && angle<=AnglePercent)
{
result = true;
}
resultBean.currentRoiImage = cutImg;
resultBean.result = result;
resultBean.percentValue =Math.Round( percent,3);
resultBean.checkData = angle;
return resultBean;
}
/// <summary>
/// 获取模板相似度
/// </summary>
/// <param name="standardImage"></param>
/// <param name="imageToCheck"></param>
/// <param name="cutImg"></param>
/// <returns></returns>
public (double,double) GetTemplateMatchPercent(Image standardImage, Image imageToCheck, out Image cutImg)
{
var template = Eyemlib.eyemCvtToEyemImage((Bitmap)standardImage);
var search = Eyemlib.eyemCvtToEyemImage((Bitmap)imageToCheck);
int iNumMatches = 15;//目标个数
double dToleranceAngle = 0.0;//要检测目标容忍角度
double dMaxOverlap = 0.0;//重叠比例
double dScore = 0.8;//最小分数
cutImg = null;
//模板匹配
EyemTargetMatch[] tpResults = new EyemTargetMatch[iNumMatches];
IntPtr ResultHandle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EyemTargetMatch)) * tpResults.Length);
var rect = RoiPath.GetBounds();
if (rect== RectangleF.Empty)
return (0d, 0d);
rect.X -= CenterOffsetX;
rect.Y -= CenterOffsetY;
//框选模板匹配位置(通常左上角位置选一块)
EyemRect tpRoiTemplate = new EyemRect();
tpRoiTemplate.iXs = (int)(rect.X);
tpRoiTemplate.iYs = (int)(rect.Y);
tpRoiTemplate.iWidth = (int)rect.Width;
tpRoiTemplate.iHeight = (int)rect.Height;
//var search = eyemCvtToEyemImage((Bitmap)imageToCheck);
Eyemlib.eyemCopyRegion(search, tpRoiTemplate, out Eyemlib.EyemImage templ);
cutImg = eyemCvtToBitmap(templ);
//可以用来调试查看图像
//Eyemlib.eyemNamedWindow("templ");
//Eyemlib.eyemImshow("templ", templ);
//Eyemlib.eyemWaitkey();
//Eyemlib.eyemImshow("templ", template);
//Eyemlib.eyemWaitkey();
Eyemlib.eyemMakeNCCModel(templ, 256);
//额外用法包括确定电容正负极,比如模板为0方向,搜寻到目标角度|angle|>45°判断极性错误等等
var flag = Eyemlib.eyemFindNCCModel(template, dToleranceAngle, iNumMatches, dMaxOverlap, dScore, true, ResultHandle, out EyemImage tpDstImg);
if (flag != 0)
return (0,0);
eyemImageFree(ref templ);
eyemImageFree(ref template);
eyemImageFree(ref search);
tpResults = Eyemlib.eyemIntPtr2StructArray<EyemTargetMatch>(ResultHandle, tpResults.Length).ToArray();
int matchscore = 0;
double anglescore = 0;
//检测到目标
for (int i = 0; i < tpResults.Length; i++)
{
if (tpResults[i].fMatchScore > 0 && rect.Contains(tpResults[i].fCenterX, tpResults[i].fCenterY))
{
matchscore = (int)(tpResults[i].fMatchScore*100);
anglescore = Math.Abs(tpResults[i].fMatchAngle);
Console.WriteLine(string.Format("目标{0},位置({1},{2}),匹配分数{3}",
i, tpResults[i].fCenterX.ToString("F3"), tpResults[i].fCenterY.ToString("F3"), tpResults[i].fMatchScore.ToString("F3")));
}
}
if (matchscore == 0) {
Bitmap bitmap = Eyemlib.eyemCvtToBitmap(tpDstImg);
bitmap.Save("\\match.png");
}
eyemImageFree(ref tpDstImg);
Marshal.FreeHGlobal(ResultHandle);
return (matchscore,anglescore);
}
}
}
此文件的差异被折叠, 点击展开。
......@@ -2,4 +2,5 @@
<packages>
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net45" />
<package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net45" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net46" />
</packages>
\ No newline at end of file
......@@ -8,13 +8,14 @@
<OutputType>WinExe</OutputType>
<RootNamespace>AOIProject</RootNamespace>
<AssemblyName>AOIProject</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
......@@ -22,6 +23,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -78,6 +81,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>
......@@ -24,7 +24,7 @@ namespace AOIProject
//string path = "F:\\Data\\";
//string filename = "F:\\Data\\11111.data";
AccAOI.camera.CameraManager.LoadCamera();
AOIResourceCulture.SetCurrentCulture(AOIResourceCulture.China);
AOIResourceCulture.SetCurrentCulture(AOIResourceCulture.English);
//Application.Run(new FrmAoiSetting(filename, null,path));
Application.Run(new FrmAoiSetting());
AccAOI.camera.CameraManager.CloseCamera();
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AOIProject.Properties
{
namespace AOIProject.Properties {
using System;
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AOIProject.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
......@@ -52,18 +47,15 @@ namespace AOIProject.Properties
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AOIProject.Properties
{
namespace AOIProject.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}
......
......@@ -38,10 +38,12 @@ namespace AccAOI
{
LoadData();
}
ControlType.Mark = AOIResourceCulture.GetValue("图像校准点");
ControlType.Mark = AOIResourceCulture.GetValue("图像校准点1");
ControlType.EyemMark = AOIResourceCulture.GetValue("图像校准点");
ControlType.AOIBlob = AOIResourceCulture.GetValue("斑点分析");
ControlType.AOIRGB = AOIResourceCulture.GetValue("颜色抽取");
ControlType.Match = AOIResourceCulture.GetValue("模板匹配");
ControlType.Match = AOIResourceCulture.GetValue("模板匹配1");
ControlType.EyemMatch = AOIResourceCulture.GetValue("模板匹配");
ControlType.ColorMatch = AOIResourceCulture.GetValue("颜色匹配");
}
private static void LoadData()
......
......@@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<RootNamespace>AccAOI</RootNamespace>
<AssemblyName>AccAOI</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
......@@ -42,6 +42,10 @@
<Reference Include="Asa.Theme">
<HintPath>..\dll\Asa.Theme.dll</HintPath>
</Reference>
<Reference Include="ConfigHelper, Version=1.0.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="MvCameraControl.Net">
<HintPath>..\dll\MvCameraControl.Net.dll</HintPath>
</Reference>
......@@ -59,6 +63,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......@@ -74,6 +79,18 @@
<Compile Include="AOIResourceCulture.cs" />
<Compile Include="camera\CameraManager.cs" />
<Compile Include="ControlUtil.cs" />
<Compile Include="control\AioEyemMarkControl.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="control\AioEyemMarkControl.Designer.cs">
<DependentUpon>AioEyemMarkControl.cs</DependentUpon>
</Compile>
<Compile Include="control\AioEyemTempMatchControl.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="control\AioEyemTempMatchControl.Designer.cs">
<DependentUpon>AioEyemTempMatchControl.cs</DependentUpon>
</Compile>
<Compile Include="control\AoiColorMatchControl.cs">
<SubType>Form</SubType>
</Compile>
......@@ -131,6 +148,12 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="control\AioEyemMarkControl.resx">
<DependentUpon>AioEyemMarkControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="control\AioEyemTempMatchControl.resx">
<DependentUpon>AioEyemTempMatchControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="control\AoiColorMatchControl.resx">
<DependentUpon>AoiColorMatchControl.cs</DependentUpon>
</EmbeddedResource>
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>
......@@ -22,6 +22,10 @@ namespace AccAOI
{
return ControlType.Mark;
}
else if (method is AoiEyemMarkMethod)
{
return ControlType.EyemMark;
}
else if (method is AoiMethodRgb)
{
return ControlType.AOIRGB;
......@@ -29,6 +33,9 @@ namespace AccAOI
else if (method is AoiTemplateMethod)
{
return ControlType.Match;
}else if (method is AoiEyemTemplateMethod)
{
return ControlType.EyemMatch;
}else if(method is AoiColorMatchMethod)
{
return ControlType.ColorMatch;
......@@ -43,6 +50,10 @@ namespace AccAOI
methodInfo = new AoiMarkMethod();
}
else if (type.Equals(ControlType.EyemMark))
{
methodInfo = new AoiEyemMarkMethod();
}
else if (type.Equals(ControlType.AOIBlob))
{
methodInfo = new AoiBlobMethod();
......@@ -54,6 +65,9 @@ namespace AccAOI
else if (type.Equals(ControlType.Match))
{
methodInfo = new AoiTemplateMethod();
}else if (type.Equals(ControlType.EyemMatch))
{
methodInfo = new AoiEyemTemplateMethod();
}else if (type.Equals(ControlType.ColorMatch))
{
methodInfo = new AoiColorMatchMethod();
......@@ -72,6 +86,10 @@ namespace AccAOI
{
aoiControl = new control.AioMarkControl();
}
else if (method is AoiEyemMarkMethod)
{
aoiControl = new control.AioEyemMarkControl();
}
else if (method is AoiMethodRgb)
{
aoiControl = new control.AoiRgbControl();
......@@ -79,7 +97,12 @@ namespace AccAOI
else if (method is AoiTemplateMethod)
{
aoiControl = new control.AioTempMatchControl();
}else if(method is AoiColorMatchMethod)
}
else if (method is AoiEyemTemplateMethod)
{
aoiControl = new control.AioEyemTempMatchControl();
}
else if(method is AoiColorMatchMethod)
{
aoiControl = new control.AoiColorMatchControl();
}
......@@ -136,7 +159,8 @@ namespace AccAOI
/// <summary>
/// 图像校准点
/// </summary>
public static string Mark =AOIResourceCulture.GetValue( "图像校准点");
public static string Mark =AOIResourceCulture.GetValue( "图像校准点1");
public static string EyemMark =AOIResourceCulture.GetValue( "图像校准点");
/// <summary>
/// 斑点分析
/// </summary>
......@@ -148,8 +172,8 @@ namespace AccAOI
/// <summary>
/// 模板匹配
/// </summary>
public static string Match = AOIResourceCulture.GetValue("模板匹配");
public static string Match = AOIResourceCulture.GetValue("模板匹配1");
public static string EyemMatch = AOIResourceCulture.GetValue("模板匹配");
/// <summary>
/// 模板匹配
/// </summary>
......
......@@ -39,7 +39,6 @@ namespace AccAOI
this.btnNewAoi = new Asa.Theme.FlatButton();
this.btnOpenImage = new Asa.Theme.FlatButton();
this.btnGetCameraImg = new Asa.Theme.FlatButton();
this.comType = new Asa.Theme.FlatCombo();
this.panAoi = new System.Windows.Forms.Panel();
this.btnExcute = new Asa.Theme.FlatButton();
this.btnDel = new Asa.Theme.FlatButton();
......@@ -54,6 +53,7 @@ namespace AccAOI
this.lblTestResult = new System.Windows.Forms.Label();
this.imageBox1 = new Acc.ImageBox.AccImageBox();
this.btnCopy = new Asa.Theme.FlatButton();
this.btnPCBRect = new Asa.Theme.FlatButton();
this.panTest.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
......@@ -64,10 +64,10 @@ namespace AccAOI
| System.Windows.Forms.AnchorStyles.Left)));
this.aoiList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.aoiList.Inside = false;
this.aoiList.Location = new System.Drawing.Point(249, 141);
this.aoiList.Location = new System.Drawing.Point(249, 210);
this.aoiList.Name = "aoiList";
this.aoiList.SelectedIndex = -1;
this.aoiList.Size = new System.Drawing.Size(156, 474);
this.aoiList.Size = new System.Drawing.Size(156, 405);
this.aoiList.TabIndex = 2;
this.aoiList.SelectedIndexChanged += new Asa.Theme.Event.SelectedIndexChanged(this.aoiList_IndexChanged);
//
......@@ -105,12 +105,12 @@ namespace AccAOI
this.btnNewAoi.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNewAoi.ImageSize = new System.Drawing.Size(0, 0);
this.btnNewAoi.Inside = false;
this.btnNewAoi.Location = new System.Drawing.Point(330, 68);
this.btnNewAoi.Location = new System.Drawing.Point(249, 102);
this.btnNewAoi.Name = "btnNewAoi";
this.btnNewAoi.Size = new System.Drawing.Size(75, 30);
this.btnNewAoi.Size = new System.Drawing.Size(156, 30);
this.btnNewAoi.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnNewAoi.TabIndex = 8;
this.btnNewAoi.Text = "新增";
this.btnNewAoi.Text = "新增模版";
this.btnNewAoi.Click += new System.EventHandler(this.btnNewAoi_Click);
//
// btnOpenImage
......@@ -141,17 +141,6 @@ namespace AccAOI
this.btnGetCameraImg.Text = "获取基准图片";
this.btnGetCameraImg.Click += new System.EventHandler(this.btnGetCameraImg_Click);
//
// comType
//
this.comType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.comType.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comType.Inside = false;
this.comType.Location = new System.Drawing.Point(249, 33);
this.comType.Name = "comType";
this.comType.SelectedIndex = 0;
this.comType.Size = new System.Drawing.Size(156, 30);
this.comType.TabIndex = 14;
//
// panAoi
//
this.panAoi.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
......@@ -182,7 +171,7 @@ namespace AccAOI
this.btnDel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDel.ImageSize = new System.Drawing.Size(0, 0);
this.btnDel.Inside = false;
this.btnDel.Location = new System.Drawing.Point(249, 68);
this.btnDel.Location = new System.Drawing.Point(330, 174);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(75, 30);
this.btnDel.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
......@@ -251,7 +240,7 @@ namespace AccAOI
this.btnUpdateName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateName.ImageSize = new System.Drawing.Size(0, 0);
this.btnUpdateName.Inside = false;
this.btnUpdateName.Location = new System.Drawing.Point(330, 104);
this.btnUpdateName.Location = new System.Drawing.Point(249, 174);
this.btnUpdateName.Name = "btnUpdateName";
this.btnUpdateName.Size = new System.Drawing.Size(75, 30);
this.btnUpdateName.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
......@@ -320,18 +309,33 @@ namespace AccAOI
this.btnCopy.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCopy.ImageSize = new System.Drawing.Size(0, 0);
this.btnCopy.Inside = false;
this.btnCopy.Location = new System.Drawing.Point(249, 104);
this.btnCopy.Location = new System.Drawing.Point(249, 138);
this.btnCopy.Name = "btnCopy";
this.btnCopy.Size = new System.Drawing.Size(75, 30);
this.btnCopy.Size = new System.Drawing.Size(156, 30);
this.btnCopy.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnCopy.TabIndex = 26;
this.btnCopy.Text = "复制";
this.btnCopy.Text = "复制模版";
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
//
// btnPCBRect
//
this.btnPCBRect.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnPCBRect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnPCBRect.ImageSize = new System.Drawing.Size(0, 0);
this.btnPCBRect.Inside = false;
this.btnPCBRect.Location = new System.Drawing.Point(249, 33);
this.btnPCBRect.Name = "btnPCBRect";
this.btnPCBRect.Size = new System.Drawing.Size(156, 30);
this.btnPCBRect.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnPCBRect.TabIndex = 27;
this.btnPCBRect.Text = "设置基准PCB范围";
this.btnPCBRect.Click += new System.EventHandler(this.btnPCBRect_Click);
//
// FrmAoiSetting
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1307, 624);
this.Controls.Add(this.btnPCBRect);
this.Controls.Add(this.panel1);
this.Controls.Add(this.btnCopy);
this.Controls.Add(this.panTest);
......@@ -343,7 +347,6 @@ namespace AccAOI
this.Controls.Add(this.btnDel);
this.Controls.Add(this.btnExcute);
this.Controls.Add(this.panAoi);
this.Controls.Add(this.comType);
this.Controls.Add(this.btnGetCameraImg);
this.Controls.Add(this.btnOpenImage);
this.Controls.Add(this.btnNewAoi);
......@@ -374,7 +377,6 @@ namespace AccAOI
private Asa.Theme.FlatButton btnNewAoi;
private Asa.Theme.FlatButton btnOpenImage;
private Asa.Theme.FlatButton btnGetCameraImg;
private Asa.Theme.FlatCombo comType;
private System.Windows.Forms.Panel panAoi;
private Asa.Theme.FlatButton btnExcute;
private Asa.Theme.FlatButton btnDel;
......@@ -388,5 +390,6 @@ namespace AccAOI
private System.Windows.Forms.Label lblTestResult;
private System.Windows.Forms.Panel panel1;
private Asa.Theme.FlatButton btnCopy;
private Asa.Theme.FlatButton btnPCBRect;
}
}
\ No newline at end of file
......@@ -40,14 +40,14 @@ namespace AccAOI
string newName = txtName.Text.Trim();
if (newName.Length > 30||newName.Length<2)
{
MyMessage.Show(" 请输入正确名称(长度 2~30)", newName);
MyMessage.Show(AOIResourceCulture.GetValue(" 请输入正确名称(长度 2~30)"), newName);
txtName.Focus();
return;
}
if (AllNameList.Contains(newName))
{
MyMessage.Show("名称【{0}】已存在,请重新输入", newName);
MyMessage.Show(AOIResourceCulture.GetValue("名称【{0}】已存在,请重新输入", newName));
txtName.Focus();
return;
}
......
......@@ -19,7 +19,7 @@ namespace AccAOI.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......@@ -47,8 +47,8 @@ namespace AccAOI.Properties {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
......
......@@ -12,7 +12,7 @@ namespace AccAOI.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -14,114 +14,133 @@ FrmAoiSetting_btnNewAoi_Text=New
FrmAoiSetting_btnSavePro_Text=Save project
FrmAoiSetting_btnOpenPro_Text=Open project
AioMarkControl_btnClearArea_Text=Clear
AioMarkControl_panResult_Text=result judgment
AioMarkControl_panParam_Text=parameter setting
AioMarkControl_panAreaSet_Text=Locale - rectangle
AioMarkControl_panAreaImage_Text=Regional image
AioMarkControl_panControl_Text=00_MarkPoint set
AioMarkControl_panResult_Text=Result Judgment
AioMarkControl_panParam_Text=Parameter Setting
AioMarkControl_panAreaSet_Text=Locale - Rectangle
AioMarkControl_panAreaImage_Text=Regional Image
AioMarkControl_panControl_Text=00_MarkPoint Set
AoiRgbControl_btnUpdate_Text=Update
AoiRgbControl_flatLabel9_Text=real time data
AoiRgbControl_flatLabel9_Text=Real Time Data
AoiRgbControl_flatLabel2_Text=MinR:
AoiRgbControl_flatLabel5_Text=~
AoiRgbControl_flatLabel3_Text=Pixels of:
AoiRgbControl_panResult_Text=result judgment
AoiRgbControl_panParam_Text=parameter setting
AoiRgbControl_panResult_Text=Result Judgment
AoiRgbControl_panParam_Text=Parameter Setting
AoiRgbControl_btnClearArea_Text=Clear
AoiRgbControl_panAreaSet_Text=Locale - rectangle
AoiRgbControl_panAreaImage_Text=Regional image
AoiRgbControl_panControl_Text=01_Color extraction
AoiRgbControl_panAreaSet_Text=Locale - Rectangle
AoiRgbControl_panAreaImage_Text=Regional Image
AoiRgbControl_panControl_Text=01_Color Extraction
AioTempMatchControl_btnClearArea_Text=Clear
AioTempMatchControl_panResult_Text=result judgment
AioTempMatchControl_panParam_Text=parameter setting
AioTempMatchControl_panAreaSet_Text=Locale - rectangle
AioTempMatchControl_panAreaImage_Text=Regional image
AioTempMatchControl_panControl_Text=02_template matching
AioTempMatchControl_panResult_Text=Result Judgment
AioTempMatchControl_panParam_Text=Parameter Setting
AioTempMatchControl_panAreaSet_Text=Locale - Rectangle
AioTempMatchControl_panAreaImage_Text=Regional Image
AioTempMatchControl_panControl_Text=02_Template Matching
AoiBlobControl_flatLabel7_Text=DataResult:
AoiBlobControl_btnUpdate_Text=Update
AoiBlobControl_flatLabel4_Text=~
AoiBlobControl_flatLabel6_Text=The number of:
AoiBlobControl_flatLabel6_Text=NO.
AoiBlobControl_flatLabel5_Text=~
AoiBlobControl_flatLabel2_Text=Graphics inversion:
AoiBlobControl_flatLabel3_Text=Area of filter:
AoiBlobControl_flatLabel2_Text=Graphics Inversion:
AoiBlobControl_flatLabel3_Text=Area of Filter:
AoiBlobControl_lblthresh_Text=100
AoiBlobControl_flatLabel1_Text= Threshold:
AoiBlobControl_panResult_Text=result judgment
AoiBlobControl_panParam_Text=parameter setting
AoiBlobControl_flatLabel1_Text=Threshold:
AoiBlobControl_panResult_Text=Result Judgment
AoiBlobControl_panParam_Text=Parameter Setting
AoiBlobControl_btnClearArea_Text=Clear
AoiBlobControl_panAreaSet_Text=Locale - rectangle
AoiBlobControl_panAreaImage_Text=Regional image
AoiBlobControl_panControl_Text=04_spot analysis
AioMarkControl_btnOpenImage_Text=Open local image
AoiBlobControl_panAreaSet_Text=Locale - Rectangle
AoiBlobControl_panAreaImage_Text=Regional Image
AoiBlobControl_panControl_Text=04_Spot Analysis
AioMarkControl_btnOpenImage_Text=Open Local Image
AioMarkControl_btnTest_Text=test result
AioMarkControl_flatLabel3_Text=similarity:
AioMarkControl_flatLabel3_Text=Similarity:
AioMarkControl_flatLabel2_Text=Mark Area X
AioMarkControl_flatLabel1_Text= Search Area:
AioMarkControl_btnImgType_Text=original
AioMarkControl_btnSetArea_Text=ellipse
AioMarkControl_btnImgType_Text=Original
AioMarkControl_btnSetArea_Text=Ellipse
AoiRgbControl_flatLabel7_Text=MaxB:
AoiRgbControl_flatLabel1_Text=MaxR:
AoiRgbControl_flatLabel6_Text=MinG:
AoiRgbControl_flatLabel4_Text=MaxG:
AoiRgbControl_flatLabel8_Text=MinB:
AoiRgbControl_btnImgType_Text=original
AoiRgbControl_btnSetArea_Text=ellipse
AioTempMatchControl_btnOpenImage_Text=Open local image
AioTempMatchControl_btnTest_Text=test result
AioTempMatchControl_flatLabel3_Text=similarity
AioTempMatchControl_btnImgType_Text=original
AioTempMatchControl_btnSetArea_Text=ellipse
AoiRgbControl_btnImgType_Text=Original
AoiRgbControl_btnSetArea_Text=Ellipse
AioTempMatchControl_btnOpenImage_Text=Open Local Image
AioTempMatchControl_btnTest_Text=Test Result
AioTempMatchControl_flatLabel3_Text=Similarity
AioTempMatchControl_btnImgType_Text=Original
AioTempMatchControl_btnSetArea_Text=Ellipse
AoiBlobControl_lblList_Text=Area of a list:
AoiBlobControl_btnImgType_Text=original
AoiBlobControl_btnSetArea_Text=ellipse
AoiColorMatchControl_panResult_Text=result judgment
AoiColorMatchControl_btnTest_Text=test result
AoiColorMatchControl_panParam_Text=parameter setting
AoiColorMatchControl_flatLabel3_Text=similarity:
AoiColorMatchControl_panAreaSet_Text=Locale - rectangle
AoiBlobControl_btnImgType_Text=Original
AoiBlobControl_btnSetArea_Text=Ellipse
AoiColorMatchControl_panResult_Text=Result Judgment
AoiColorMatchControl_btnTest_Text=Test Result
AoiColorMatchControl_panParam_Text=Parameter Setting
AoiColorMatchControl_flatLabel3_Text=Similarity:
AoiColorMatchControl_panAreaSet_Text=Locale - Rectangle
AoiColorMatchControl_btnClearArea_Text=Clear
AoiColorMatchControl_btnImgType_Text=original
AoiColorMatchControl_btnSetArea_Text=ellipse
AoiColorMatchControl_panAreaImage_Text=Regional image
图像校准点=Image calibration point
斑点分析=Spot analysis
颜色抽取=Color extraction
模板匹配=Template matching
颜色匹配=color matching
效果图=rendering Image
区域图 - 原图=Area map - original
AoiColorMatchControl_btnImgType_Text=Original
AoiColorMatchControl_btnSetArea_Text=Ellipse
AoiColorMatchControl_panAreaImage_Text=Regional Image
FrmAoiSetting_btnPCBRect_Text=Set PCB Criteria Range
AioEyemMarkControl_btnTest_Text=Apply
AioEyemMarkControl_flatLabel3_Text=Similarity:
AioEyemMarkControl_flatLabel2_Text=Mark area x
AioEyemMarkControl_flatLabel1_Text=Matching area:
AioEyemMarkControl_btnClearArea_Text=Clear
AioEyemTempMatchControl_btnTest_Text=Test result
AioEyemTempMatchControl_flatLabel1_Text=Angle difference:
AioEyemTempMatchControl_flatLabel3_Text=Similarity:
AioEyemTempMatchControl_btnClearArea_Text=Clear
图像校准点=Image Calibration Point
斑点分析=Spot Analysis
颜色抽取=Color Extraction
模板匹配=Template Matching
颜色匹配=Color Matching
效果图=Rendering Image
区域图 - 原图=Area Map - Original
面积列表:=Area of a list:
编号=number
编号=NO.
面积↓=Area↓
X坐标=X
Y坐标=Y
打开本地图片=Open local image
Mark区域无效=Mark Area is invalid
打开本地图片=Open Local Image
Mark区域无效=Mark area is invalid.
是否打开新项目?=Open a new project?
提示=reminder
提示=Reminder
打开项目=Open the project
保存项目=Save the project
保存成功=Save success
确定删除{0} ?=Sure to delete {0}?
确认提示=confirmation
请输入修改后的名称=Please enter a modified name
确认提示=Confirmation
请输入修改后的名称=Please enter a modified name.
FrmMethodName_btnOk_Text=OK
FrmMethodName_btnCancel_Text=Cancel
请输入新【{0}】名称=Please enter a new [{0}] name
显示基准图片=Display standard image
测试/效果图:=Testing/rendering Image:
显示测试图片=Switch to test image
请输入新【{0}】名称=Please enter a new [{0}] name.
显示基准图片=Display Standard Image
测试/效果图:=Testing/Rendering Image:
显示测试图片=Switch To Test Image
基准图:=Standard Image:
原图=original
区域图像 - 效果图=Area image - renderings
区域设置 - 椭圆=Locale - ellipse
矩形=rectangle
区域设置 - 矩形=Locale - rectangle
椭圆=ellipse
参数设置=parameter setting
结果判断=result judgment
原图=Original
区域图像 - 效果图=Area Image - Renderings
区域设置 - 椭圆=Locale - Ellipse
矩形=Rectangle
区域设置 - 矩形=Locale - Rectangle
椭圆=Ellipse
参数设置=Parameter Setting
结果判断=Result Judgment
中文=Chinese
英文=English
请输入正确名称(长度 2~30)=Please enter the correct name (length 2~30)
请输入正确名称(长度 2~30)=Please enter the correct name (length 2~30).
目标范围=Target
实际值= actual
\ No newline at end of file
实际值=Actual
匹配失败=Matching failed.
请选择测试图片=Please select the test image.
加载项目{0}失败:=Loading project {0} failed.
没有找到相机=No camera.
获取图片失败=Failed to get image.
在框选区域内没有找到PCB=No PCB in the selected area.
没有项目可保存=No project to be saved.
请先选择基准图片=Please select reference piture.
设置基准PCB范围=Set PCB Criteria Range
模版匹配=Template Matching
......@@ -73,7 +73,6 @@ AioTempMatchControl_btnSetArea_Text=椭圆
AoiBlobControl_lblList_Text=面积列表:
AoiBlobControl_btnImgType_Text=原图
AoiBlobControl_btnSetArea_Text=椭圆
AoiColorMatchControl_panResult_Text=结果判断
AoiColorMatchControl_btnTest_Text=测试结果
AoiColorMatchControl_panParam_Text=参数设置
......@@ -83,6 +82,16 @@ AoiColorMatchControl_btnClearArea_Text=清除
AoiColorMatchControl_btnImgType_Text=原图
AoiColorMatchControl_btnSetArea_Text=椭圆
AoiColorMatchControl_panAreaImage_Text=区域图像 - 效果图
FrmAoiSetting_btnPCBRect_Text=设置基准PCB范围
AioEyemMarkControl_btnTest_Text=应用
AioEyemMarkControl_flatLabel3_Text=相似度:
AioEyemMarkControl_flatLabel2_Text=Mark区域x
AioEyemMarkControl_flatLabel1_Text=搜索区域:
AioEyemMarkControl_btnClearArea_Text=清除
AioEyemTempMatchControl_btnTest_Text=测试结果
AioEyemTempMatchControl_flatLabel1_Text=角度差:
AioEyemTempMatchControl_flatLabel3_Text=相似度:
AioEyemTempMatchControl_btnClearArea_Text=清除
图像校准点=图像校准点
斑点分析=斑点分析
颜色抽取=颜色抽取
......@@ -105,8 +114,8 @@ Mark区域无效=Mark区域无效
确定删除{0} ?=确定删除{0} ?
确认提示=确认提示
请输入修改后的名称=请输入修改后的名称
FrmMethodName_btnOk_Text=确定
FrmMethodName_btnCancel_Text=取消
FrmMethodName_btnOk_Text=FrmMethodName_btnOk_Text
FrmMethodName_btnCancel_Text=FrmMethodName_btnCancel_Text
请输入新【{0}】名称=请输入新【{0}】名称
显示基准图片=显示基准图片
测试/效果图:=测试/效果图:
......@@ -124,4 +133,14 @@ FrmMethodName_btnCancel_Text=取消
英文=英文
请输入正确名称(长度 2~30)=请输入正确名称(长度 2~30)
目标范围=目标范围
实际值= 实际值
\ No newline at end of file
实际值=实际值
匹配失败=匹配失败
请选择测试图片=请选择测试图片
加载项目{0}失败:=加载项目{0}失败:
没有找到相机=没有找到相机
获取图片失败=获取图片失败
在框选区域内没有找到PCB=在框选区域内没有找到PCB
没有项目可保存=没有项目可保存
请先选择基准图片=请先选择基准图片
设置基准PCB范围=设置基准PCB范围
模版匹配=模版匹配
......@@ -98,6 +98,7 @@ namespace AccAOI.control
{
// this.BImageBox.CleearArea();
this.aoiImage.Image = null;
//GetAoiInfo().RoiPath = null;
BImageBox.SelectNone();
}
......@@ -188,6 +189,12 @@ namespace AccAOI.control
ConProcess(pancon, className);
}
}
else if (con.Controls.Count > 0) {
foreach (System.Windows.Forms.Control pancon in con.Controls)
{
ConProcess(pancon, className);
}
}
}
private void ABaseControl_VisibleChanged(object sender, EventArgs e)
......
namespace AccAOI.control
{
partial class AioEyemMarkControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.flatLabel1 = new Asa.Theme.FlatLabel();
this.flatTextSearchZoom = new Asa.Theme.FlatText();
this.flatLabel2 = new Asa.Theme.FlatLabel();
this.lblResult = new System.Windows.Forms.Label();
this.btnTest = new Asa.Theme.FlatButton();
this.lblTime = new System.Windows.Forms.Label();
this.trackBarSamePercent = new System.Windows.Forms.TrackBar();
this.flatLabel3 = new Asa.Theme.FlatLabel();
this.txtSamePercent = new Asa.Theme.FlatText();
this.panParam.SuspendLayout();
this.panResult.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarSamePercent)).BeginInit();
this.SuspendLayout();
//
// panParam
//
this.panParam.Controls.Add(this.txtSamePercent);
this.panParam.Controls.Add(this.trackBarSamePercent);
this.panParam.Controls.Add(this.flatLabel3);
this.panParam.Controls.Add(this.flatLabel2);
this.panParam.Controls.Add(this.flatTextSearchZoom);
this.panParam.Controls.Add(this.flatLabel1);
this.panParam.Size = new System.Drawing.Size(298, 91);
//
// panResult
//
this.panResult.Controls.Add(this.lblTime);
this.panResult.Controls.Add(this.btnTest);
this.panResult.Controls.Add(this.lblResult);
this.panResult.Location = new System.Drawing.Point(4, 416);
this.panResult.Size = new System.Drawing.Size(298, 408);
//
// flatLabel1
//
this.flatLabel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatLabel1.Font = new System.Drawing.Font("微软雅黑", 9F);
this.flatLabel1.Inside = false;
this.flatLabel1.Location = new System.Drawing.Point(6, 116);
this.flatLabel1.Name = "flatLabel1";
this.flatLabel1.Size = new System.Drawing.Size(98, 30);
this.flatLabel1.TabIndex = 0;
this.flatLabel1.Text = "搜索区域:";
this.flatLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// flatTextSearchZoom
//
this.flatTextSearchZoom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatTextSearchZoom.Font = new System.Drawing.Font("微软雅黑", 9F);
this.flatTextSearchZoom.Inside = false;
this.flatTextSearchZoom.Location = new System.Drawing.Point(209, 117);
this.flatTextSearchZoom.Name = "flatTextSearchZoom";
this.flatTextSearchZoom.Size = new System.Drawing.Size(55, 30);
this.flatTextSearchZoom.TabIndex = 1;
this.flatTextSearchZoom.Text = "2";
//
// flatLabel2
//
this.flatLabel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatLabel2.Font = new System.Drawing.Font("微软雅黑", 9F);
this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(110, 116);
this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(93, 30);
this.flatLabel2.TabIndex = 2;
this.flatLabel2.Text = "Mark区域x";
//
// lblResult
//
this.lblResult.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.lblResult.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.ForeColor = System.Drawing.Color.Red;
this.lblResult.Location = new System.Drawing.Point(12, 94);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(276, 24);
this.lblResult.TabIndex = 4;
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnTest
//
this.btnTest.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnTest.Font = new System.Drawing.Font("微软雅黑", 9F);
this.btnTest.ImageSize = new System.Drawing.Size(0, 0);
this.btnTest.Inside = false;
this.btnTest.Location = new System.Drawing.Point(92, 40);
this.btnTest.Name = "btnTest";
this.btnTest.Size = new System.Drawing.Size(115, 30);
this.btnTest.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnTest.TabIndex = 5;
this.btnTest.Text = "应用";
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
//
// lblTime
//
this.lblTime.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.lblTime.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTime.ForeColor = System.Drawing.Color.Green;
this.lblTime.Location = new System.Drawing.Point(12, 129);
this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(276, 24);
this.lblTime.TabIndex = 8;
this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// trackBarSamePercent
//
this.trackBarSamePercent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.trackBarSamePercent.Location = new System.Drawing.Point(125, 40);
this.trackBarSamePercent.Maximum = 100;
this.trackBarSamePercent.Name = "trackBarSamePercent";
this.trackBarSamePercent.Size = new System.Drawing.Size(165, 45);
this.trackBarSamePercent.TabIndex = 12;
this.trackBarSamePercent.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBarSamePercent.Value = 50;
this.trackBarSamePercent.ValueChanged += new System.EventHandler(this.trackBarSamePercent_ValueChanged);
//
// flatLabel3
//
this.flatLabel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatLabel3.Font = new System.Drawing.Font("微软雅黑", 9F);
this.flatLabel3.Inside = false;
this.flatLabel3.Location = new System.Drawing.Point(5, 37);
this.flatLabel3.Name = "flatLabel3";
this.flatLabel3.Size = new System.Drawing.Size(74, 30);
this.flatLabel3.TabIndex = 11;
this.flatLabel3.Text = "相似度:";
this.flatLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtSamePercent
//
this.txtSamePercent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.txtSamePercent.Font = new System.Drawing.Font("微软雅黑", 9F);
this.txtSamePercent.Inside = false;
this.txtSamePercent.Location = new System.Drawing.Point(81, 37);
this.txtSamePercent.Name = "txtSamePercent";
this.txtSamePercent.Padding = new System.Windows.Forms.Padding(3);
this.txtSamePercent.Size = new System.Drawing.Size(41, 30);
this.txtSamePercent.TabIndex = 26;
this.txtSamePercent.Text = "50";
this.txtSamePercent.TextChanged += new System.EventHandler(this.txtSamePercent_TextChanged);
//
// AioEyemMarkControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(312, 833);
this.Name = "AioEyemMarkControl";
this.TitleName = "Mark设置";
this.panParam.ResumeLayout(false);
this.panParam.PerformLayout();
this.panResult.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackBarSamePercent)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Asa.Theme.FlatLabel flatLabel2;
private Asa.Theme.FlatText flatTextSearchZoom;
private Asa.Theme.FlatLabel flatLabel1;
private System.Windows.Forms.Label lblResult;
private Asa.Theme.FlatButton btnTest;
private System.Windows.Forms.Label lblTime;
private System.Windows.Forms.TrackBar trackBarSamePercent;
private Asa.Theme.FlatLabel flatLabel3;
private Asa.Theme.FlatText txtSamePercent;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AOI;
using System.Threading;
using System.Drawing.Drawing2D;
using System.IO;
using Asa.Theme;
namespace AccAOI.control
{
public partial class AioEyemMarkControl : ABaseControl
{
public AioEyemMarkControl()
{
InitializeComponent();
}
public override AoiMethod GetAoiInfo()
{
if (this.AoiInfo is AoiEyemMarkMethod)
{
AoiEyemMarkMethod method = (AoiEyemMarkMethod)AoiInfo;
float.TryParse(flatTextSearchZoom.Text, out float zoom);
method.SearchPathZoom = zoom;
if (currPath != null)
{
method.RoiPath = currPath;
}
int value =trackBarSamePercent.Value;
SetText(txtSamePercent, trackBarSamePercent.Value);
// int value = trackBarSamePercent.Value;
method.SamePercent = value;
AoiInfo = method;
}
return AoiInfo;
}
public override void ShowAoiInfo()
{
if (this.AoiInfo is AoiEyemMarkMethod)
{
AoiEyemMarkMethod method = (AoiEyemMarkMethod)AoiInfo;
trackBarSamePercent.Value = (int)method.SamePercent;
flatTextSearchZoom.Text = method.SearchPathZoom.ToString();
IsShowOk = true;
SetCurrImageType(1);
UpdateImage();
}
}
private void btnTest_Click(object sender, EventArgs e)
{
if (this.AoiInfo is AoiEyemMarkMethod)
{
Image checkImg = FrmAoiSetting.TestImage;
if (checkImg == null)
{
MyMessage.Show("请选择测试图片");
return;
}
DateTime time = DateTime.Now;
AoiEyemMarkMethod mark = (AoiEyemMarkMethod)AoiInfo;
if (mark.RoiPath == null || mark.RoiPath.PathPoints.Count() == 0) {
MyMessage.Show("请选择匹配范围");
return;
}
double sameValue = 0;
Image result = mark.FixImage(FrmAoiSetting.BaseImg, FrmAoiSetting.TestImage, out sameValue);
TimeSpan span = DateTime.Now - time;
lblResult.Text = "";
if (result == null)
{
this.aoiImage.Image = null;
lblResult.ForeColor = Color.Red;
lblResult.Text = AOIResourceCulture.GetValue("Mark区域无效") + " (" + sameValue + "%)";
}
else
{
SetCurrImageType(2);
lblResult.ForeColor = Color.Green;
lblResult.Text = "OK";// + "(" + Math.Round(sameValue*100) + "%)";
this.aoiImage.Image = result;
}
lblTime.Text = "times :" + Math.Round(span.TotalSeconds, 1) + "s";
}
}
public override void UpdateImage()
{
if (!IsShowOk)
{
return;
}
if (Monitor.TryEnter(UpdateLock))
{
try
{
int value = trackBarSamePercent.Value;
SetText(txtSamePercent, trackBarSamePercent.Value);
Image BaseImage = FrmAoiSetting.OrgBaseImg;//GetImg();
if (BaseImage == null || currPath == null)
{
return;
}
GetAoiInfo();
AoiEyemMarkMethod markMethod = (AoiEyemMarkMethod)AoiInfo;
GraphicsPath searchPath = markMethod.GetSearchPath();
BImageBox.ShowPath(searchPath, Color.Yellow);
if (ShowImageType.Equals(1))
{
Image cutImage = markMethod.GetRoiImage(BaseImage, true);
aoiImage.Image = cutImage;
}
else
{
aoiImage.Image = null;
}
GC.Collect();
}
catch (Exception ex)
{
Console.WriteLine("UpdateImage出错:" + ex.ToString());
}
finally
{
Monitor.Exit(UpdateLock);
}
}
else
{
Console.WriteLine("UpdateImage执行失败,未得到锁");
}
}
//private void btnOpenImage_Click(object sender, EventArgs e)
//{
// System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
// openDialog.Title = AOIResourceCulture.GetValue("打开本地图片");
// openDialog.Filter = "All Supported Images (*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png)|*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
// openDialog.DefaultExt = "png";
// //openDialog.DefaultExt = "png";
// System.Windows.Forms.DialogResult result = openDialog.ShowDialog();
// if (result == System.Windows.Forms.DialogResult.Cancel)
// {
// return;
// }
// string fileName = openDialog.FileName;
// txtImage.Text = fileName;
//}
private void trackBarSamePercent_ValueChanged(object sender, EventArgs e)
{
UpdateImage();
}
private void SetTbValue(TrackBar tb, int value)
{
if (tb.Value.Equals(value.ToString()))
{
return;
}
if (value < tb.Minimum)
{
tb.Value = tb.Minimum;
}
else if (value > tb.Maximum)
{
tb.Value = tb.Maximum;
}
else
{
tb.Value = value;
}
UpdateImage();
}
private void SetText(FlatText text, int value)
{
if (text.Text.ToString().Equals(value.ToString()))
{
return;
}
text.Text = value.ToString();
}
private void txtSamePercent_TextChanged(object sender, EventArgs e)
{
int value = AOIFormUtil.GetIntValue(txtSamePercent);
SetTbValue(trackBarSamePercent, value);
UpdateImage();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AOI;
using System.Threading;
using System.Drawing.Drawing2D;
using System.IO;
using Asa.Theme;
namespace AccAOI.control
{
public partial class AioEyemMarkControl : ABaseControl
{
public AioEyemMarkControl()
{
InitializeComponent();
}
public override AoiMethod GetAoiInfo()
{
if (this.AoiInfo is AoiEyemMarkMethod)
{
AoiEyemMarkMethod method = (AoiEyemMarkMethod)AoiInfo;
float.TryParse(flatTextSearchZoom.Text, out float zoom);
method.SearchPathZoom = zoom;
if (currPath != null)
{
method.RoiPath = currPath;
}
int value =trackBarSamePercent.Value;
SetText(txtSamePercent, trackBarSamePercent.Value);
// int value = trackBarSamePercent.Value;
method.SamePercent = value;
AoiInfo = method;
}
return AoiInfo;
}
public override void ShowAoiInfo()
{
if (this.AoiInfo is AoiEyemMarkMethod)
{
AoiEyemMarkMethod method = (AoiEyemMarkMethod)AoiInfo;
trackBarSamePercent.Value = (int)method.SamePercent;
flatTextSearchZoom.Text = method.SearchPathZoom.ToString();
IsShowOk = true;
SetCurrImageType(1);
UpdateImage();
}
}
private void btnTest_Click(object sender, EventArgs e)
{
if (this.AoiInfo is AoiEyemMarkMethod)
{
Image checkImg = FrmAoiSetting.OrgBaseImg;
if (checkImg == null)
{
MyMessage.Show("请选择基准图片");
return;
}
FrmAoiSetting.BaseImg = FrmAoiSetting.Project.ProcessBaseImage((Bitmap)FrmAoiSetting.OrgBaseImg,"基准图");
FrmAoiSetting.Project.standardImage = FrmAoiSetting.BaseImg;
var cutbounds = FrmAoiSetting.Project.BaseROI.RoiPath.GetBounds();
if (FrmAoiSetting.TestImage != null )
{
var widthdiff = Math.Abs(FrmAoiSetting.TestImage.Width - cutbounds.Width);
var heightdiff = Math.Abs(FrmAoiSetting.TestImage.Height - cutbounds.Height);
if (widthdiff > 2 && heightdiff > 2)
{
FrmAoiSetting.TestImage = FrmAoiSetting.Project.ProcessBaseImage((Bitmap)FrmAoiSetting.OrgTestImage,"测试图");
}
}
SetCurrImageType(2);
lblResult.ForeColor = Color.Green;
lblResult.Text = "OK";// + "(" + Math.Round(sameValue*100) + "%)";
this.aoiImage.Image = FrmAoiSetting.BaseImg;
//lblTime.Text = "times :" + Math.Round(span.TotalSeconds, 1) + "s";
}
}
public override void UpdateImage()
{
if (!IsShowOk)
{
return;
}
if (Monitor.TryEnter(UpdateLock))
{
try
{
int value = trackBarSamePercent.Value;
SetText(txtSamePercent, trackBarSamePercent.Value);
Image BaseImage = FrmAoiSetting.OrgBaseImg;//GetImg();
if (BaseImage == null || currPath == null)
{
return;
}
GetAoiInfo();
AoiEyemMarkMethod markMethod = (AoiEyemMarkMethod)AoiInfo;
GraphicsPath searchPath = markMethod.GetSearchPath();
BImageBox.ShowPath(searchPath, Color.Yellow);
if (ShowImageType.Equals(1))
{
Image cutImage = markMethod.GetRoiImage(BaseImage, true);
aoiImage.Image = cutImage;
}
else
{
aoiImage.Image = null;
}
GC.Collect();
}
catch (Exception ex)
{
Console.WriteLine("UpdateImage出错:" + ex.ToString());
}
finally
{
Monitor.Exit(UpdateLock);
}
}
else
{
Console.WriteLine("UpdateImage执行失败,未得到锁");
}
}
//private void btnOpenImage_Click(object sender, EventArgs e)
//{
// System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
// openDialog.Title = AOIResourceCulture.GetValue("打开本地图片");
// openDialog.Filter = "All Supported Images (*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png)|*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
// openDialog.DefaultExt = "png";
// //openDialog.DefaultExt = "png";
// System.Windows.Forms.DialogResult result = openDialog.ShowDialog();
// if (result == System.Windows.Forms.DialogResult.Cancel)
// {
// return;
// }
// string fileName = openDialog.FileName;
// txtImage.Text = fileName;
//}
private void trackBarSamePercent_ValueChanged(object sender, EventArgs e)
{
UpdateImage();
}
private void SetTbValue(TrackBar tb, int value)
{
if (tb.Value.Equals(value.ToString()))
{
return;
}
if (value < tb.Minimum)
{
tb.Value = tb.Minimum;
}
else if (value > tb.Maximum)
{
tb.Value = tb.Maximum;
}
else
{
tb.Value = value;
}
UpdateImage();
}
private void SetText(FlatText text, int value)
{
if (text.Text.ToString().Equals(value.ToString()))
{
return;
}
text.Text = value.ToString();
}
private void txtSamePercent_TextChanged(object sender, EventArgs e)
{
int value = AOIFormUtil.GetIntValue(txtSamePercent);
SetTbValue(trackBarSamePercent, value);
UpdateImage();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AOI;
using System.Threading;
using System.Drawing.Drawing2D;
using System.IO;
using Asa.Theme;
namespace AccAOI.control
{
public partial class AioEyemTempMatchControl : ABaseControl
{
public AioEyemTempMatchControl()
{
InitializeComponent();
}
public override AoiMethod GetAoiInfo()
{
if (this.AoiInfo is AoiEyemTemplateMethod)
{
AoiEyemTemplateMethod method = (AoiEyemTemplateMethod)AoiInfo;
if (currPath != null)
{
method.RoiPath = currPath;
}
int value =trackBarSamePercent.Value;
SetText(txtSamePercent, trackBarSamePercent.Value);
SetText(txtAnglePercent, trackBarAnglePercent.Value);
// int value = trackBarSamePercent.Value;
method.SamePercent = value;
method.AnglePercent = trackBarAnglePercent.Value;
AoiInfo = method;
}
return AoiInfo;
}
public override void ShowAoiInfo()
{
if (this.AoiInfo is AoiEyemTemplateMethod)
{
AoiEyemTemplateMethod method = (AoiEyemTemplateMethod)AoiInfo;
trackBarSamePercent.Value = (int)method.SamePercent;
trackBarAnglePercent.Value = (int)method.AnglePercent;
IsShowOk = true;
SetCurrImageType(1);
UpdateImage();
}
}
private void btnTest_Click(object sender, EventArgs e)
{
if (this.AoiInfo is AoiEyemTemplateMethod)
{
Image checkImg = FrmAoiSetting.TestImage;
if (checkImg == null)
{
MyMessage.Show("请选择测试图片");
return;
}
DateTime time = DateTime.Now;
AoiEyemTemplateMethod Match = (AoiEyemTemplateMethod)AoiInfo;
ResultBean result = Match.Check(FrmAoiSetting.BaseImg, checkImg);
TimeSpan span = DateTime.Now - time;
lblResult.Text = "";
if (result == null)
{
this.aoiImage.Image = null;
lblResult.ForeColor = Color.Red;
lblResult.Text = AOIResourceCulture.GetValue("匹配失败") + " (0%)";
}
else
{
lblResult.ForeColor = Color.Green;
//lblResult.Text =result.result? "OK" :"NG" ;
if (!result.result)
{
lblResult.ForeColor = Color.Red;
}
lblResult.Text += "(" + result.percentValue + "%, " + ((double)result.checkData).ToString("F2") + "°)";
if (result.currentRoiImage != null)
{
SetCurrImageType(2);
this.aoiImage.Image = result.currentRoiImage;
}
}
lblTime.Text = "times :" + Math.Round(span.TotalSeconds, 1) + "s";
}
}
public override void UpdateImage()
{
if (!IsShowOk)
{
return;
}
if (Monitor.TryEnter(UpdateLock))
{
try
{
SetText(txtSamePercent, trackBarSamePercent.Value);
SetText(txtAnglePercent, trackBarAnglePercent.Value);
Image BaseImage = GetImg();
if (BaseImage == null || currPath == null)
{
return;
}
GetAoiInfo();
AoiEyemTemplateMethod MatchMethod = (AoiEyemTemplateMethod)AoiInfo;
MatchMethod.RoiPath = currPath;
if (ShowImageType.Equals(1))
{
Image cutImage = MatchMethod.GetRoiImage(BaseImage, true);
aoiImage.Image = cutImage;
}
else
{
aoiImage.Image = null;
}
GC.Collect();
}
catch (Exception ex)
{
Console.WriteLine("UpdateImage出错:" + ex.ToString());
}
finally
{
Monitor.Exit(UpdateLock);
}
}
else
{
Console.WriteLine("UpdateImage执行失败,未得到锁");
}
}
private void trackBarSamePercent_ValueChanged(object sender, EventArgs e)
{
UpdateImage();
}
private void SetTbValue(TrackBar tb, int value)
{
if (tb.Value.Equals(value.ToString()))
{
return;
}
if (value < tb.Minimum)
{
tb.Value = tb.Minimum;
}
else if (value > tb.Maximum)
{
tb.Value = tb.Maximum;
}
else
{
tb.Value = value;
}
UpdateImage();
}
private void SetText(FlatText text, int value)
{
if (text.Text.ToString().Equals(value.ToString()))
{
return;
}
text.Text = value.ToString();
}
private void txtSamePercent_TextChanged(object sender, EventArgs e)
{
int value = AOIFormUtil.GetIntValue(txtSamePercent);
int value2 = AOIFormUtil.GetIntValue(txtAnglePercent);
SetTbValue(trackBarSamePercent, value);
SetTbValue(trackBarAnglePercent, value2);
UpdateImage();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -60,7 +60,7 @@ namespace AccAOI.control
Image checkImg = FrmAoiSetting.TestImage;
if (checkImg == null)
{
MyMessage.Show("请选择测试图片");
MyMessage.Show(AOIResourceCulture.GetValue("请选择测试图片"));
return;
}
DateTime time = DateTime.Now;
......
......@@ -61,7 +61,7 @@ namespace AccAOI.control
if (checkImg == null)
{
MyMessage.Show("请选择测试图片");
MyMessage.Show(AOIResourceCulture.GetValue("请选择测试图片"));
return;
}
DateTime time = DateTime.Now;
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net46" />
<package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net46" requireReinstallation="true" />
</packages>
\ No newline at end of file
......@@ -654,7 +654,9 @@ namespace Acc.ImageBox
for (int i = 0; i < pathPoints.Length; i++)
{
PointF p = pathPoints[i];
if (p.X == this.ResizePoint.X && p.Y == this.ResizePoint.Y)
var xdiff = Math.Abs(p.X - this.ResizePoint.X) < 3;
var ydiff = Math.Abs(p.Y - this.ResizePoint.Y) < 3;
if (xdiff && ydiff)
{
pathPoints[i] = endPoint;
this.ResizePoint = endPoint;
......@@ -664,7 +666,7 @@ namespace Acc.ImageBox
GraphicsPath path = new GraphicsPath(pathPoints, this.SelectionRegion.PathTypes);
this.SelectionRegion = path;
}
else
else if (Control.ModifierKeys == Keys.Shift)
{
//按比例缩放
......@@ -698,12 +700,38 @@ namespace Acc.ImageBox
var newCenterY = newBounds.Y + newBounds.Height / 2;
matrix.Reset();
matrix.Translate(oldCenterX-newCenterX, oldCenterY - newCenterY);
matrix.Translate(oldCenterX - newCenterX, oldCenterY - newCenterY);
path.Transform(matrix);
this.DragOrigin = cursorPosition;
this.SelectionRegion = path;
}
else {
//自由变形
Point endPoint = this.PointToImage(cursorPosition, true);
PointF[] pathPoints = this.SelectionRegion.PathPoints;
PointF startPoint= PointF.Empty;
for (int i = 0; i < pathPoints.Length; i++)
{
PointF p = pathPoints[i];
var xdiff = Math.Abs(p.X - this.ResizePoint.X) < 3;
var ydiff = Math.Abs(p.Y - this.ResizePoint.Y) < 3;
if (xdiff && ydiff)
{ if (i<1)
startPoint = pathPoints[i+2];
else
startPoint = pathPoints[i - 2];
pathPoints[i] = endPoint;
this.ResizePoint = endPoint;
break;
}
}
GraphicsPath path = new GraphicsPath();
path.AddRectangle(new RectangleF(startPoint.X, startPoint.Y, endPoint.X- startPoint.X, endPoint.Y- startPoint.Y));
this.SelectionRegion = path;
}
......
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!