Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
AccAOI
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit cb72a705
由
LN
编写于
2019-06-20 10:23:24 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
e5aaae14
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
63 行增加
和
10 行删除
AOI/AoiProject.cs
AOI/blob/AoiBlobMethod.cs
AccAOI/FrmAoiSetting.Designer.cs
AccAOI/FrmAoiSetting.cs
AccAOI/control/ABaseControl.cs
AOI/AoiProject.cs
查看文件 @
cb72a70
...
...
@@ -29,8 +29,9 @@ namespace AOI
/// </summary>
public
Dictionary
<
string
,
AoiMethod
>
methodMap
=
new
Dictionary
<
string
,
AoiMethod
>();
public
List
<
ResultBean
>
CheckAll
(
Image
image
,
out
Image
resultImg
)
public
List
<
ResultBean
>
CheckAll
(
Image
scr
,
out
Image
resultImg
)
{
Image
image
=
(
Image
)
scr
.
Clone
();
//如果设置了校准方法,先校准图片
var
markMethodMap
=
methodMap
.
Where
(
kv
=>
kv
.
Value
is
AoiMarkMethod
);
foreach
(
var
item
in
markMethodMap
)
...
...
@@ -62,10 +63,10 @@ namespace AOI
{
foreach
(
ResultBean
resultBean
in
resultBeans
)
{
Pen
pen
=
new
Pen
(
Color
.
Green
);
Pen
pen
=
new
Pen
(
Color
.
YellowGreen
,
5
);
if
(!
resultBean
.
result
)
{
pen
=
new
Pen
(
Color
.
Red
);
pen
=
new
Pen
(
Color
.
Red
,
5
);
}
g
.
DrawPath
(
pen
,
resultBean
.
roiPath
);
}
...
...
AOI/blob/AoiBlobMethod.cs
查看文件 @
cb72a70
...
...
@@ -80,7 +80,12 @@ namespace AOI
{
bool
needCut
=
true
;
cutImg
=
GetRoiImage
(
srcImg
,
needCut
);
if
(
cutImg
==
null
)
{
dstCutImg
=
null
;
blobList
=
new
List
<
CvBlob
>();
return
0
;
}
Mat
srcMat
=
ImageUtil
.
ToMat
(
cutImg
);
Mat
threshMat
=
new
Mat
();
Cv2
.
CvtColor
(
srcMat
,
threshMat
,
ColorConversionCodes
.
RGB2GRAY
);
...
...
AccAOI/FrmAoiSetting.Designer.cs
查看文件 @
cb72a70
...
...
@@ -41,6 +41,7 @@ namespace AccAOI
this
.
comType
=
new
Asa
.
Theme
.
FlatCombo
();
this
.
panAoi
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
imageBox1
=
new
Cyotek
.
Windows
.
Forms
.
ImageBox
();
this
.
btnExcute
=
new
Asa
.
Theme
.
FlatButton
();
this
.
SuspendLayout
();
//
// aoiList
...
...
@@ -50,9 +51,9 @@ namespace AccAOI
this
.
aoiList
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
30
)))),
((
int
)(((
byte
)(
30
)))),
((
int
)(((
byte
)(
30
)))));
this
.
aoiList
.
Index
=
-
1
;
this
.
aoiList
.
Inside
=
false
;
this
.
aoiList
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
2
02
);
this
.
aoiList
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
2
23
);
this
.
aoiList
.
Name
=
"aoiList"
;
this
.
aoiList
.
Size
=
new
System
.
Drawing
.
Size
(
287
,
4
30
);
this
.
aoiList
.
Size
=
new
System
.
Drawing
.
Size
(
287
,
4
09
);
this
.
aoiList
.
TabIndex
=
2
;
this
.
aoiList
.
IndexChanged
+=
new
System
.
EventHandler
(
this
.
aoiList_IndexChanged
);
//
...
...
@@ -167,10 +168,23 @@ namespace AccAOI
this
.
imageBox1
.
TabIndex
=
4
;
this
.
imageBox1
.
SelectionRegionChanged
+=
new
System
.
EventHandler
(
this
.
imageBox1_SelectionRegionChanged
);
//
// btnExcute
//
this
.
btnExcute
.
ImageSize
=
new
System
.
Drawing
.
Size
(
0
,
0
);
this
.
btnExcute
.
Inside
=
false
;
this
.
btnExcute
.
Location
=
new
System
.
Drawing
.
Point
(
153
,
187
);
this
.
btnExcute
.
Name
=
"btnExcute"
;
this
.
btnExcute
.
Size
=
new
System
.
Drawing
.
Size
(
109
,
30
);
this
.
btnExcute
.
StateColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
30
)))),
((
int
)(((
byte
)(
30
)))),
((
int
)(((
byte
)(
30
)))));
this
.
btnExcute
.
TabIndex
=
16
;
this
.
btnExcute
.
Text
=
"执行"
;
this
.
btnExcute
.
Click
+=
new
System
.
EventHandler
(
this
.
btnExcute_Click
);
//
// FrmAoiSetting
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1271
,
641
);
this
.
Controls
.
Add
(
this
.
btnExcute
);
this
.
Controls
.
Add
(
this
.
panAoi
);
this
.
Controls
.
Add
(
this
.
comType
);
this
.
Controls
.
Add
(
this
.
btnGetCameraImg
);
...
...
@@ -204,5 +218,6 @@ namespace AccAOI
private
Asa
.
Theme
.
FlatButton
btnGetCameraImg
;
private
Asa
.
Theme
.
FlatCombo
comType
;
private
System
.
Windows
.
Forms
.
Panel
panAoi
;
private
Asa
.
Theme
.
FlatButton
btnExcute
;
}
}
\ No newline at end of file
AccAOI/FrmAoiSetting.cs
查看文件 @
cb72a70
...
...
@@ -17,6 +17,7 @@ namespace AccAOI
private
control
.
ABaseControl
aoiControl
=
null
;
public
static
Image
Img
=
null
;
private
AoiProject
Project
=
null
;
private
bool
CanSel
=
true
;
public
FrmAoiSetting
()
{
InitializeComponent
();
...
...
@@ -159,6 +160,11 @@ namespace AccAOI
}
private
void
ShowAoi
(
AoiMethod
method
)
{
CanSel
=
false
;
imageBox1
.
SelectNone
();
imageBox1
.
Image
=
Img
;
CanSel
=
true
;
if
(
aoiControl
==
null
)
{
if
(
method
is
AoiBlobMethod
)
...
...
@@ -189,8 +195,8 @@ namespace AccAOI
{
currPath
=
method
.
RoiPath
;
imageBox1
.
SelectionRegion
=
method
.
RoiPath
;
Image
threshImage
=
CutImage
(
imageBox1
.
Image
,
currPath
);
cutImage
=
threshImage
;
//
Image threshImage = CutImage(imageBox1.Image, currPath);
//
cutImage = threshImage;
aoiControl
.
SetCurrPath
(
currPath
,
false
);
}
...
...
@@ -269,6 +275,10 @@ namespace AccAOI
{
try
{
if
(!
CanSel
)
{
return
;
}
if
(
imageBox1
.
Image
==
null
||
Img
==
null
||
aoiControl
==
null
)
{
return
;
...
...
@@ -287,7 +297,7 @@ namespace AccAOI
// currPath.AddEllipse(region);
//}
currPath
=
imageBox1
.
SelectionRegion
;
Image
threshImage
=
CutImage
(
imageBox1
.
Image
,
currPath
);
Image
threshImage
=
CutImage
(
Img
,
currPath
);
cutImage
=
threshImage
;
aoiControl
.
SetCurrPath
(
currPath
);
...
...
@@ -327,5 +337,27 @@ namespace AccAOI
return
null
;
}
private
void
btnExcute_Click
(
object
sender
,
EventArgs
e
)
{
SaveCurrAoi
();
CanSel
=
false
;
if
(
Img
==
null
)
{
return
;
}
if
(
this
.
Project
==
null
)
{
return
;
}
Image
outImage
=
null
;
List
<
ResultBean
>
result
=
Project
.
CheckAll
(
Img
,
out
outImage
);
if
(
outImage
!=
null
)
{
this
.
imageBox1
.
SelectNone
();
this
.
imageBox1
.
Image
=
outImage
;
}
CanSel
=
true
;
}
}
}
AccAOI/control/ABaseControl.cs
查看文件 @
cb72a70
...
...
@@ -89,7 +89,7 @@ namespace AccAOI.control
{
// this.BImageBox.CleearArea();
this
.
aoiImage
.
Image
=
null
;
BImageBox
.
SelectNone
();
}
private
void
btnImgType_Click
(
object
sender
,
EventArgs
e
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论