Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
AccAOI
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f84d1e72
由
刘韬
编写于
2023-11-09 11:07:19 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
变更使用SURF对齐图像
1 个父辈
564cadce
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
183 行增加
和
71 行删除
AOI/AOI.csproj
AOI/AoiMethod.cs
AOI/AoiProject.cs
AOI/app.config
AOI/eyemlib/AoiEyemMarkMethod.cs
AOI/eyemlib/AoiEyemTemplateMethod.cs
AOI/mark/AoiMarkMethod.cs
AOI/packages.config
AOI/util/ImageUtil.cs
AOIProject/AOIProject.csproj
AOIProject/App.config
AccAOI/AccAOI.csproj
AccAOI/App.config
AccAOI/FrmAoiSetting.Designer.cs
AccAOI/FrmAoiSetting.cs
AccAOI/control/AioEyemMarkControl.cs
AccAOI/control/AoiBlobControl.cs
AccAOI/packages.config
园晶斑点分析测试/App.config
园晶斑点分析测试/Form1.cs
AOI/AOI.csproj
查看文件 @
f84d1e7
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCvSharp
3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props" Condition="Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU
.props')" />
<Import Project="..\packages\OpenCvSharp
4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win.props" Condition="Exists('..\packages\OpenCvSharp4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win
.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
...
@@ -42,20 +42,34 @@
...
@@ -42,20 +42,34 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp
3-AnyCPU.4.0.0.20181129\lib\net4
0\OpenCvSharp.dll</HintPath>
<HintPath>..\packages\OpenCvSharp
4.4.8.0.20230708\lib\netstandard2.
0\OpenCvSharp.dll</HintPath>
</Reference>
</Reference>
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Blob.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\AccAOI\bin\Debug\OpenCvSharp.Blob.dll</HintPath>
</Reference>
</Reference>
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Extensions.dll</HintPath>
<HintPath>..\packages\OpenCvSharp4.Extensions.4.8.0.20230708\lib\netstandard2.0\OpenCvSharp.Extensions.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.UserInterface.dll</HintPath>
</Reference>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.7.0.0\lib\net462\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<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>
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
</Reference>
...
@@ -85,6 +99,7 @@
...
@@ -85,6 +99,7 @@
<Compile Include="util\JsonUtil.cs" />
<Compile Include="util\JsonUtil.cs" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="packages.config" />
</ItemGroup>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
...
@@ -92,6 +107,6 @@
...
@@ -92,6 +107,6 @@
<PropertyGroup>
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
</PropertyGroup>
<Error Condition="!Exists('..\packages\OpenCvSharp
3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU
.props'))" />
<Error Condition="!Exists('..\packages\OpenCvSharp
4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win
.props'))" />
</Target>
</Target>
</Project>
</Project>
\ No newline at end of file
\ No newline at end of file
AOI/AoiMethod.cs
查看文件 @
f84d1e7
using
OpenCvSharp
;
using
OpenCvSharp
;
using
OpenCvSharp.Extensions
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Drawing
;
...
...
AOI/AoiProject.cs
查看文件 @
f84d1e7
此文件的差异被折叠,
点击展开。
AOI/app.config
0 → 100644
查看文件 @
f84d1e7
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
</
configuration
>
\ No newline at end of file
\ No newline at end of file
AOI/eyemlib/AoiEyemMarkMethod.cs
查看文件 @
f84d1e7
...
@@ -7,6 +7,7 @@ using System.Runtime.InteropServices;
...
@@ -7,6 +7,7 @@ using System.Runtime.InteropServices;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
OpenCvSharp
;
using
OpenCvSharp
;
using
OpenCvSharp.Features2D
;
using
OpenCvSharp.XFeatures2D
;
using
OpenCvSharp.XFeatures2D
;
using
static
AOI
.
Eyemlib
;
using
static
AOI
.
Eyemlib
;
...
@@ -190,8 +191,8 @@ namespace AOI
...
@@ -190,8 +191,8 @@ namespace AOI
//提取特征点
//提取特征点
SIFT
sift
=
SIFT
.
Create
(
200
);
SIFT
sift
=
SIFT
.
Create
(
200
);
KeyPoint
[]
markKeyPoints
,
srcKeyPoints
;
KeyPoint
[]
markKeyPoints
,
srcKeyPoints
;
Mat
OfFloat
roiDescriptors
=
new
MatOfFlo
at
();
Mat
roiDescriptors
=
new
M
at
();
Mat
OfFloat
srcDescriptors
=
new
MatOfFlo
at
();
Mat
srcDescriptors
=
new
M
at
();
sift
.
DetectAndCompute
(
markMat
,
null
,
out
markKeyPoints
,
roiDescriptors
);
sift
.
DetectAndCompute
(
markMat
,
null
,
out
markKeyPoints
,
roiDescriptors
);
sift
.
DetectAndCompute
(
srcMat
,
null
,
out
srcKeyPoints
,
srcDescriptors
);
sift
.
DetectAndCompute
(
srcMat
,
null
,
out
srcKeyPoints
,
srcDescriptors
);
...
...
AOI/eyemlib/AoiEyemTemplateMethod.cs
查看文件 @
f84d1e7
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Drawing
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.Drawing.Drawing2D
;
using
System.Linq
;
using
System.Linq
;
using
System.Net.Http.Headers
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -59,22 +60,28 @@ namespace AOI
...
@@ -59,22 +60,28 @@ namespace AOI
/// <returns></returns>
/// <returns></returns>
public
(
double
,
double
)
GetTemplateMatchPercent
(
Image
standardImage
,
Image
imageToCheck
,
out
Image
cutImg
)
public
(
double
,
double
)
GetTemplateMatchPercent
(
Image
standardImage
,
Image
imageToCheck
,
out
Image
cutImg
)
{
{
var
template
=
Eyemlib
.
eyemCvtToEyemImage
((
Bitmap
)
standardImage
);
cutImg
=
null
;
if
(
RoiPath
==
null
)
return
(
0d
,
0d
);
var
rect
=
RoiPath
.
GetBounds
();
if
(
rect
==
RectangleF
.
Empty
)
return
(
0d
,
0d
);
float
MatchRoi_Inflate
=
ConfigHelper
.
Config
.
Get
(
"SURF_MatchRect_Inflate"
,
0.3f
);
var
newroi
=
new
RectangleF
(
rect
.
Location
,
rect
.
Size
);
newroi
.
Inflate
(
rect
.
Width
*
MatchRoi_Inflate
,
rect
.
Height
*
MatchRoi_Inflate
);
var
bitmap1
=
AoiProject
.
CropBitmap
((
Bitmap
)
standardImage
,
newroi
);
var
template
=
Eyemlib
.
eyemCvtToEyemImage
(
bitmap1
);
var
search
=
Eyemlib
.
eyemCvtToEyemImage
((
Bitmap
)
imageToCheck
);
var
search
=
Eyemlib
.
eyemCvtToEyemImage
((
Bitmap
)
imageToCheck
);
int
iNumMatches
=
1
5
;
//目标个数
int
iNumMatches
=
5
;
//目标个数
double
dToleranceAngle
=
0.0
;
//要检测目标容忍角度
double
dToleranceAngle
=
0.0
;
//要检测目标容忍角度
double
dMaxOverlap
=
0.0
;
//重叠比例
double
dMaxOverlap
=
0.0
;
//重叠比例
double
dScore
=
0.8
;
//最小分数
double
dScore
=
0.8
;
//最小分数
cutImg
=
null
;
//模板匹配
//模板匹配
EyemTargetMatch
[]
tpResults
=
new
EyemTargetMatch
[
iNumMatches
];
EyemTargetMatch
[]
tpResults
=
new
EyemTargetMatch
[
iNumMatches
];
IntPtr
ResultHandle
=
Marshal
.
AllocHGlobal
(
Marshal
.
SizeOf
(
typeof
(
EyemTargetMatch
))
*
tpResults
.
Length
);
IntPtr
ResultHandle
=
Marshal
.
AllocHGlobal
(
Marshal
.
SizeOf
(
typeof
(
EyemTargetMatch
))
*
tpResults
.
Length
);
if
(
RoiPath
==
null
)
return
(
0d
,
0d
);
var
rect
=
RoiPath
.
GetBounds
();
if
(
rect
==
RectangleF
.
Empty
)
return
(
0d
,
0d
);
rect
.
X
-=
CenterOffsetX
;
rect
.
X
-=
CenterOffsetX
;
rect
.
Y
-=
CenterOffsetY
;
rect
.
Y
-=
CenterOffsetY
;
//框选模板匹配位置(通常左上角位置选一块)
//框选模板匹配位置(通常左上角位置选一块)
...
@@ -108,14 +115,16 @@ namespace AOI
...
@@ -108,14 +115,16 @@ namespace AOI
int
matchscore
=
0
;
int
matchscore
=
0
;
double
anglescore
=
0
;
double
anglescore
=
0
;
double
maxscore
=
0
;
//检测到目标
//检测到目标
for
(
int
i
=
0
;
i
<
tpResults
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
tpResults
.
Length
;
i
++)
{
{
if
(
tpResults
[
i
].
fMatchScore
>
0
&&
rect
.
Contains
(
tpResults
[
i
].
fCenterX
,
tpResults
[
i
].
fCenterY
))
if
(
tpResults
[
i
].
fMatchScore
>
0
&&
tpResults
[
i
].
fMatchScore
>
maxscore
)
// &&
rect.Contains(tpResults[i].fCenterX, tpResults[i].fCenterY))
{
{
matchscore
=
(
int
)(
tpResults
[
i
].
fMatchScore
*
100
);
matchscore
=
(
int
)(
tpResults
[
i
].
fMatchScore
*
100
);
anglescore
=
Math
.
Abs
(
tpResults
[
i
].
fMatchAngle
);
anglescore
=
Math
.
Abs
(
tpResults
[
i
].
fMatchAngle
);
maxscore
=
matchscore
;
Console
.
WriteLine
(
string
.
Format
(
"目标{0},位置({1},{2}),匹配分数{3}"
,
Console
.
WriteLine
(
string
.
Format
(
"目标{0},位置({1},{2}),匹配分数{3}"
,
i
,
tpResults
[
i
].
fCenterX
.
ToString
(
"F3"
),
tpResults
[
i
].
fCenterY
.
ToString
(
"F3"
),
tpResults
[
i
].
fMatchScore
.
ToString
(
"F3"
)));
i
,
tpResults
[
i
].
fCenterX
.
ToString
(
"F3"
),
tpResults
[
i
].
fCenterY
.
ToString
(
"F3"
),
tpResults
[
i
].
fMatchScore
.
ToString
(
"F3"
)));
...
...
AOI/mark/AoiMarkMethod.cs
查看文件 @
f84d1e7
...
@@ -6,6 +6,7 @@ using System.Linq;
...
@@ -6,6 +6,7 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
OpenCvSharp
;
using
OpenCvSharp
;
using
OpenCvSharp.Features2D
;
using
OpenCvSharp.XFeatures2D
;
using
OpenCvSharp.XFeatures2D
;
namespace
AOI
namespace
AOI
...
@@ -216,8 +217,8 @@ namespace AOI
...
@@ -216,8 +217,8 @@ namespace AOI
//提取特征点
//提取特征点
SIFT
sift
=
SIFT
.
Create
(
200
);
SIFT
sift
=
SIFT
.
Create
(
200
);
KeyPoint
[]
markKeyPoints
,
srcKeyPoints
;
KeyPoint
[]
markKeyPoints
,
srcKeyPoints
;
Mat
OfFloat
roiDescriptors
=
new
MatOfFlo
at
();
Mat
roiDescriptors
=
new
M
at
();
Mat
OfFloat
srcDescriptors
=
new
MatOfFlo
at
();
Mat
srcDescriptors
=
new
M
at
();
sift
.
DetectAndCompute
(
markMat
,
null
,
out
markKeyPoints
,
roiDescriptors
);
sift
.
DetectAndCompute
(
markMat
,
null
,
out
markKeyPoints
,
roiDescriptors
);
sift
.
DetectAndCompute
(
srcMat
,
null
,
out
srcKeyPoints
,
srcDescriptors
);
sift
.
DetectAndCompute
(
srcMat
,
null
,
out
srcKeyPoints
,
srcDescriptors
);
...
...
AOI/packages.config
查看文件 @
f84d1e7
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"Newtonsoft.Json"
version
=
"12.0.2"
targetFramework
=
"net45"
/>
<
package
id
=
"Newtonsoft.Json"
version
=
"12.0.2"
targetFramework
=
"net45"
/>
<
package
id
=
"OpenCvSharp3-AnyCPU"
version
=
"4.0.0.20181129"
targetFramework
=
"net45"
requireReinstallation
=
"true"
/>
<
package
id
=
"OpenCvSharp4"
version
=
"4.8.0.20230708"
targetFramework
=
"net472"
/>
<
package
id
=
"OpenCvSharp4.Extensions"
version
=
"4.8.0.20230708"
targetFramework
=
"net472"
/>
<
package
id
=
"OpenCvSharp4.runtime.win"
version
=
"4.8.0.20230708"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Buffers"
version
=
"4.5.1"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Drawing.Common"
version
=
"7.0.0"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Memory"
version
=
"4.5.5"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Numerics.Vectors"
version
=
"4.5.0"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Runtime.CompilerServices.Unsafe"
version
=
"6.0.0"
targetFramework
=
"net472"
/>
<
package
id
=
"System.ValueTuple"
version
=
"4.5.0"
targetFramework
=
"net46"
requireReinstallation
=
"true"
/>
<
package
id
=
"System.ValueTuple"
version
=
"4.5.0"
targetFramework
=
"net46"
requireReinstallation
=
"true"
/>
</
packages
>
</
packages
>
\ No newline at end of file
\ No newline at end of file
AOI/util/ImageUtil.cs
查看文件 @
f84d1e7
...
@@ -36,8 +36,7 @@ namespace AOI
...
@@ -36,8 +36,7 @@ namespace AOI
int
[]
channels
=
new
int
[]
{
0
};
//一个通道,初始化为通道0
int
[]
channels
=
new
int
[]
{
0
};
//一个通道,初始化为通道0
int
[]
histsize
=
new
int
[]
{
256
};
//一个通道,初始化为256箱子
int
[]
histsize
=
new
int
[]
{
256
};
//一个通道,初始化为256箱子
Rangef
[]
range
=
new
Rangef
[
1
];
//一个通道,值范围
Rangef
[]
range
=
new
Rangef
[
1
];
//一个通道,值范围
range
[
0
].
Start
=
0.0F
;
//从0开始(含)
range
[
0
]
=
new
Rangef
(
0.0F
,
256.0F
);
range
[
0
].
End
=
256.0F
;
//到256结束(不含)
Mat
mask
=
new
Mat
();
//不做掩码
Mat
mask
=
new
Mat
();
//不做掩码
Cv2
.
CalcHist
(
mats
,
channels
,
mask
,
hist
,
1
,
histsize
,
range
);
//计算灰度图,dim为1 1维
Cv2
.
CalcHist
(
mats
,
channels
,
mask
,
hist
,
1
,
histsize
,
range
);
//计算灰度图,dim为1 1维
return
hist
;
return
hist
;
...
...
AOIProject/AOIProject.csproj
查看文件 @
f84d1e7
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<TargetFrameworkProfile />
<TargetFrameworkProfile />
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>
x64
</PlatformTarget>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>false</Optimize>
...
@@ -42,22 +42,6 @@
...
@@ -42,22 +42,6 @@
<Reference Include="Asa.Theme">
<Reference Include="Asa.Theme">
<HintPath>..\dll\Asa.Theme.dll</HintPath>
<HintPath>..\dll\Asa.Theme.dll</HintPath>
</Reference>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Blob.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Extensions.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.UserInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml.Linq" />
...
...
AOIProject/App.config
查看文件 @
f84d1e7
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
configuration
>
<
startup
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.7.2"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.7.2"
/>
</
startup
>
</
startup
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
</
configuration
>
</
configuration
>
AccAOI/AccAOI.csproj
查看文件 @
f84d1e7
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCvSharp
3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props" Condition="Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU
.props')" />
<Import Project="..\packages\OpenCvSharp
4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win.props" Condition="Exists('..\packages\OpenCvSharp4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win
.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
...
@@ -50,19 +50,30 @@
...
@@ -50,19 +50,30 @@
<HintPath>..\dll\MvCameraControl.Net.dll</HintPath>
<HintPath>..\dll\MvCameraControl.Net.dll</HintPath>
</Reference>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.dll</HintPath>
<HintPath>..\packages\OpenCvSharp4.4.8.0.20230708\lib\netstandard2.0\OpenCvSharp.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Blob.dll</HintPath>
</Reference>
</Reference>
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099" />
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Extensions.dll</HintPath>
<HintPath>..\packages\OpenCvSharp4.Extensions.4.8.0.20230708\lib\netstandard2.0\OpenCvSharp.Extensions.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.UserInterface.dll</HintPath>
</Reference>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.7.0.0\lib\net462\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data.DataSetExtensions" />
...
@@ -227,6 +238,6 @@
...
@@ -227,6 +238,6 @@
<PropertyGroup>
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
</PropertyGroup>
<Error Condition="!Exists('..\packages\OpenCvSharp
3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU
.props'))" />
<Error Condition="!Exists('..\packages\OpenCvSharp
4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp4.runtime.win.4.8.0.20230708\build\netstandard\OpenCvSharp4.runtime.win
.props'))" />
</Target>
</Target>
</Project>
</Project>
\ No newline at end of file
\ No newline at end of file
AccAOI/App.config
查看文件 @
f84d1e7
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
configuration
>
<
startup
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.7.2"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.7.2"
/>
</
startup
>
</
startup
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
</
configuration
>
</
configuration
>
AccAOI/FrmAoiSetting.Designer.cs
查看文件 @
f84d1e7
...
@@ -54,6 +54,7 @@ namespace AccAOI
...
@@ -54,6 +54,7 @@ namespace AccAOI
this
.
imageBox1
=
new
Acc
.
ImageBox
.
AccImageBox
();
this
.
imageBox1
=
new
Acc
.
ImageBox
.
AccImageBox
();
this
.
btnCopy
=
new
Asa
.
Theme
.
FlatButton
();
this
.
btnCopy
=
new
Asa
.
Theme
.
FlatButton
();
this
.
btnPCBRect
=
new
Asa
.
Theme
.
FlatButton
();
this
.
btnPCBRect
=
new
Asa
.
Theme
.
FlatButton
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
panTest
.
SuspendLayout
();
this
.
panTest
.
SuspendLayout
();
this
.
panel1
.
SuspendLayout
();
this
.
panel1
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
...
@@ -331,10 +332,21 @@ namespace AccAOI
...
@@ -331,10 +332,21 @@ namespace AccAOI
this
.
btnPCBRect
.
Text
=
"设置基准PCB范围"
;
this
.
btnPCBRect
.
Text
=
"设置基准PCB范围"
;
this
.
btnPCBRect
.
Click
+=
new
System
.
EventHandler
(
this
.
btnPCBRect_Click
);
this
.
btnPCBRect
.
Click
+=
new
System
.
EventHandler
(
this
.
btnPCBRect_Click
);
//
//
// label1
//
this
.
label1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
206
,
588
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
29
,
23
);
this
.
label1
.
TabIndex
=
23
;
this
.
label1
.
Text
=
"label1"
;
this
.
label1
.
Click
+=
new
System
.
EventHandler
(
this
.
label1_Click
);
//
// FrmAoiSetting
// FrmAoiSetting
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1307
,
624
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1307
,
624
);
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
btnPCBRect
);
this
.
Controls
.
Add
(
this
.
btnPCBRect
);
this
.
Controls
.
Add
(
this
.
panel1
);
this
.
Controls
.
Add
(
this
.
panel1
);
this
.
Controls
.
Add
(
this
.
btnCopy
);
this
.
Controls
.
Add
(
this
.
btnCopy
);
...
@@ -391,5 +403,6 @@ namespace AccAOI
...
@@ -391,5 +403,6 @@ namespace AccAOI
private
System
.
Windows
.
Forms
.
Panel
panel1
;
private
System
.
Windows
.
Forms
.
Panel
panel1
;
private
Asa
.
Theme
.
FlatButton
btnCopy
;
private
Asa
.
Theme
.
FlatButton
btnCopy
;
private
Asa
.
Theme
.
FlatButton
btnPCBRect
;
private
Asa
.
Theme
.
FlatButton
btnPCBRect
;
private
System
.
Windows
.
Forms
.
Label
label1
;
}
}
}
}
\ No newline at end of file
\ No newline at end of file
AccAOI/FrmAoiSetting.cs
查看文件 @
f84d1e7
using
AccAOI.camera
;
using
AccAOI.camera
;
using
AOI
;
using
AOI
;
using
OpenCvSharp.Blob
;
using
OpenCvSharp.XFeatures2D
;
using
OpenCvSharp
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.ComponentModel
;
...
@@ -13,13 +14,20 @@ using System.Linq;
...
@@ -13,13 +14,20 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
OpenCvSharp.Extensions
;
namespace
AccAOI
namespace
AccAOI
{
{
public
partial
class
FrmAoiSetting
:
FrmBase
public
partial
class
FrmAoiSetting
:
FrmBase
{
{
private
control
.
ABaseControl
aoiControl
=
null
;
private
control
.
ABaseControl
aoiControl
=
null
;
/// <summary>
/// 原始剪裁基准图
/// </summary>
public
static
Image
BaseImg
=
null
;
public
static
Image
BaseImg
=
null
;
/// <summary>
/// 原始基准大图
/// </summary>
public
static
Image
OrgBaseImg
=
null
;
public
static
Image
OrgBaseImg
=
null
;
public
static
Eyemlib
.
EyemImage
EyemBaseImg
=
new
Eyemlib
.
EyemImage
();
public
static
Eyemlib
.
EyemImage
EyemBaseImg
=
new
Eyemlib
.
EyemImage
();
public
static
Image
TestImage
=
null
;
public
static
Image
TestImage
=
null
;
...
@@ -223,15 +231,33 @@ namespace AccAOI
...
@@ -223,15 +231,33 @@ namespace AccAOI
return
Eyemlib
.
DeepClone
(
orgimage
);
return
Eyemlib
.
DeepClone
(
orgimage
);
}
}
else
{
else
{
var
(
BaseImg
,
EyemBaseImg
,
result
)
=
Eyemlib
.
ExtractPCB
(
orgimage
,
markroi
.
RoiPath
.
GetBounds
());
BaseImg
=
AoiProject
.
CropBitmap
(
orgimage
,
markroi
.
RoiPath
.
GetBounds
());
if
(!
result
)
{
return
(
Bitmap
)
BaseImg
;
}
}
public
Bitmap
ProcessTestImage
(
Bitmap
targetimage
)
{
var
markroi
=
Project
?.
BaseROI
;
if
(
markroi
==
null
||
markroi
.
RoiPath
==
null
||
markroi
.
RoiPath
.
GetBounds
()
==
RectangleF
.
Empty
)
{
return
Eyemlib
.
DeepClone
(
targetimage
);
}
else
{
RectangleF
rectangleF
=
markroi
.
RoiPath
.
GetBounds
();
var
result
=
AoiProject
.
SURF_MatchTemplate
((
Bitmap
)
OrgBaseImg
,
targetimage
,
rectangleF
,
out
Bitmap
matchBitmap
);
//var (BaseImg, EyemBaseImg, result) = Eyemlib.ExtractPCB(orgimage, markroi.RoiPath.GetBounds());
if
(!
result
)
{
MessageBox
.
Show
(
AOIResourceCulture
.
GetValue
(
"在框选区域内没有找到PCB"
));
MessageBox
.
Show
(
AOIResourceCulture
.
GetValue
(
"在框选区域内没有找到PCB"
));
return
null
;
return
null
;
}
}
return
(
Bitmap
)
BaseImg
;
return
matchBitmap
;
}
}
}
}
private
void
btnOpenPro_Click
(
object
sender
,
EventArgs
e
)
private
void
btnOpenPro_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
Project
!=
null
)
if
(
Project
!=
null
)
...
@@ -434,7 +460,7 @@ namespace AccAOI
...
@@ -434,7 +460,7 @@ namespace AccAOI
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
aoiControl
.
FormBorderStyle
=
FormBorderStyle
.
None
;
aoiControl
.
FormBorderStyle
=
FormBorderStyle
.
None
;
aoiControl
.
StartPosition
=
FormStartPosition
.
CenterParent
;
aoiControl
.
StartPosition
=
FormStartPosition
.
CenterParent
;
aoiControl
.
Location
=
new
Point
(
0
,
0
);
aoiControl
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
aoiControl
.
BImageBox
=
this
.
imageBox1
;
aoiControl
.
BImageBox
=
this
.
imageBox1
;
aoiControl
.
AoiInfo
=
method
;
aoiControl
.
AoiInfo
=
method
;
aoiControl
.
Size
=
panAoi
.
Size
;
aoiControl
.
Size
=
panAoi
.
Size
;
...
@@ -584,7 +610,7 @@ namespace AccAOI
...
@@ -584,7 +610,7 @@ namespace AccAOI
}
}
lblTestResult
.
Text
=
""
;
lblTestResult
.
Text
=
""
;
Image
outImage
=
null
;
Image
outImage
=
null
;
List
<
ResultBean
>
result
=
Project
.
CheckAll
(
Org
TestImage
,
out
outImage
);
List
<
ResultBean
>
result
=
Project
.
CheckAll
(
TestImage
,
out
outImage
);
if
(
outImage
!=
null
)
if
(
outImage
!=
null
)
{
{
if
(!
this
.
panTest
.
Visible
)
if
(!
this
.
panTest
.
Visible
)
...
@@ -672,7 +698,7 @@ namespace AccAOI
...
@@ -672,7 +698,7 @@ namespace AccAOI
//file.Dispose();
//file.Dispose();
var
b
=
new
Bitmap
(
fileName
);
var
b
=
new
Bitmap
(
fileName
);
OrgTestImage
=
Eyemlib
.
DeepClone
(
b
);
OrgTestImage
=
Eyemlib
.
DeepClone
(
b
);
TestImage
=
Process
Base
Image
(
b
);
TestImage
=
Process
Test
Image
(
b
);
b
.
Dispose
();
b
.
Dispose
();
testImageBox1
.
Image
=
TestImage
;
testImageBox1
.
Image
=
TestImage
;
...
@@ -726,7 +752,7 @@ namespace AccAOI
...
@@ -726,7 +752,7 @@ namespace AccAOI
//file.Dispose();
//file.Dispose();
var
bmp
=
new
Bitmap
(
filePath
+
fileName
);
var
bmp
=
new
Bitmap
(
filePath
+
fileName
);
OrgTestImage
=
Eyemlib
.
DeepClone
(
bmp
);
OrgTestImage
=
Eyemlib
.
DeepClone
(
bmp
);
TestImage
=
Process
Base
Image
(
Eyemlib
.
DeepClone
(
bmp
));
TestImage
=
Process
Test
Image
(
Eyemlib
.
DeepClone
(
bmp
));
bmp
.
Dispose
();
bmp
.
Dispose
();
//读取图片内容
//读取图片内容
testImageBox1
.
Image
=
TestImage
;
testImageBox1
.
Image
=
TestImage
;
...
@@ -922,5 +948,10 @@ namespace AccAOI
...
@@ -922,5 +948,10 @@ namespace AccAOI
imageBox1
.
Image
=
OrgBaseImg
;
imageBox1
.
Image
=
OrgBaseImg
;
}
}
}
}
private
void
label1_Click
(
object
sender
,
EventArgs
e
)
{
ConfigHelper
.
AdvanceConfigForm
.
ShowEditDialog
(
this
);
}
}
}
}
}
AccAOI/control/AioEyemMarkControl.cs
查看文件 @
f84d1e7
...
@@ -76,7 +76,7 @@ namespace AccAOI.control
...
@@ -76,7 +76,7 @@ namespace AccAOI.control
var
heightdiff
=
Math
.
Abs
(
FrmAoiSetting
.
TestImage
.
Height
-
cutbounds
.
Height
);
var
heightdiff
=
Math
.
Abs
(
FrmAoiSetting
.
TestImage
.
Height
-
cutbounds
.
Height
);
if
(
widthdiff
>
2
&&
heightdiff
>
2
)
if
(
widthdiff
>
2
&&
heightdiff
>
2
)
{
{
FrmAoiSetting
.
TestImage
=
FrmAoiSetting
.
Project
.
Process
Base
Image
((
Bitmap
)
FrmAoiSetting
.
OrgTestImage
,
"测试图"
);
FrmAoiSetting
.
TestImage
=
FrmAoiSetting
.
Project
.
Process
Test
Image
((
Bitmap
)
FrmAoiSetting
.
OrgTestImage
,
"测试图"
);
}
}
}
}
...
...
AccAOI/control/AoiBlobControl.cs
查看文件 @
f84d1e7
...
@@ -8,8 +8,8 @@ using System.Text;
...
@@ -8,8 +8,8 @@ using System.Text;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
AOI
;
using
AOI
;
using
OpenCvSharp.Blob
;
using
System.Threading
;
using
System.Threading
;
using
OpenCvSharp.Blob
;
namespace
AccAOI.control
namespace
AccAOI.control
{
{
...
...
AccAOI/packages.config
查看文件 @
f84d1e7
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"OpenCvSharp3-AnyCPU"
version
=
"4.0.0.20181129"
targetFramework
=
"net46"
requireReinstallation
=
"true"
/>
<
package
id
=
"OpenCvSharp4"
version
=
"4.8.0.20230708"
targetFramework
=
"net472"
/>
<
package
id
=
"OpenCvSharp4.Extensions"
version
=
"4.8.0.20230708"
targetFramework
=
"net472"
/>
<
package
id
=
"OpenCvSharp4.runtime.win"
version
=
"4.8.0.20230708"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Buffers"
version
=
"4.5.1"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Drawing.Common"
version
=
"7.0.0"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Memory"
version
=
"4.5.5"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Numerics.Vectors"
version
=
"4.5.0"
targetFramework
=
"net472"
/>
<
package
id
=
"System.Runtime.CompilerServices.Unsafe"
version
=
"6.0.0"
targetFramework
=
"net472"
/>
</
packages
>
</
packages
>
\ No newline at end of file
\ No newline at end of file
园晶斑点分析测试/App.config
查看文件 @
f84d1e7
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
configuration
>
<
startup
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.7.2"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.7.2"
/>
</
startup
>
</
startup
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime.CompilerServices.Unsafe"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
</
configuration
>
</
configuration
>
\ No newline at end of file
\ No newline at end of file
园晶斑点分析测试/Form1.cs
查看文件 @
f84d1e7
...
@@ -57,7 +57,7 @@ namespace 园晶斑点分析测试
...
@@ -57,7 +57,7 @@ namespace 园晶斑点分析测试
Cv2
.
GaussianBlur
(
srcMat2
,
srcMat2
,
new
OpenCvSharp
.
Size
(
3
,
3
),
200
);
Cv2
.
GaussianBlur
(
srcMat2
,
srcMat2
,
new
OpenCvSharp
.
Size
(
3
,
3
),
200
);
Cv2
.
Threshold
(
srcMat2
,
srcMat2
,
30
,
255
,
threshType
);
Cv2
.
Threshold
(
srcMat2
,
srcMat2
,
30
,
255
,
threshType
);
Cv2
.
ImShow
(
"www"
,
srcMat2
);
Cv2
.
ImShow
(
"www"
,
srcMat2
);
return
;
//
return;
//CvBlobs blobs = new CvBlobs();
//CvBlobs blobs = new CvBlobs();
////blobs.FilterByArea(200, 255);
////blobs.FilterByArea(200, 255);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论