Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
AccAOI
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0fdda9d7
由
LN
编写于
2019-08-07 13:32:24 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
b3c9937e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
48 行增加
和
15 行删除
AOI/mark/AoiMarkMethod.cs
AccAOI/FrmAoiSetting.cs
AOI/mark/AoiMarkMethod.cs
查看文件 @
0fdda9d
...
...
@@ -31,7 +31,9 @@ namespace AOI
/// <returns></returns>
public
GraphicsPath
GetSearchPath
()
{
if
(
RoiPath
!=
null
&&
SearchPathZoom
>
0
)
try
{
if
(
RoiPath
!=
null
&&
SearchPathZoom
>
0
)
{
GraphicsPath
SearchPath
=
new
GraphicsPath
(
RoiPath
.
PathPoints
,
RoiPath
.
PathTypes
);
Matrix
matrix
=
new
Matrix
();
...
...
@@ -53,6 +55,10 @@ namespace AOI
return
SearchPath
;
}
return
RoiPath
;
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
ToString
());
}
return
null
;
}
/// <summary>
...
...
AccAOI/FrmAoiSetting.cs
查看文件 @
0fdda9d
...
...
@@ -38,14 +38,14 @@ namespace AccAOI
// BaseImg = image;
// Project = new AoiProject(image);
string
result
=
""
;
Project
=
AoiProject
.
Load
(
programPath
,
out
result
);
Project
=
AoiProject
.
Load
(
programPath
,
out
result
);
if
(!
result
.
Equals
(
""
))
{
MessageBox
.
Show
(
"加载项目"
+
programPath
+
"失败:\r\n"
+
result
);
}
else
{
currProjectFileName
=
programPath
;
currProjectFileName
=
programPath
;
}
}
if
(
image
!=
null
)
...
...
@@ -133,7 +133,7 @@ namespace AccAOI
}
//将图片保存到本地重新加载
// string filePath = Application.StartupPath + @"\aimage\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + DateTime.Now.Millisecond.ToString().PadLeft(3, '0') ;
string
filePath
=
Application
.
StartupPath
+
@"\aimage\"
;
string
fileName
=
@"\
test
.bmp"
;
string
fileName
=
@"\
base
.bmp"
;
using
(
Bitmap
img
=
CameraManager
.
GetCamerImage
(
camera
))
{
if
(
img
!=
null
)
...
...
@@ -145,6 +145,11 @@ namespace AccAOI
}
img
.
Save
(
filePath
+
fileName
,
ImageFormat
.
Bmp
);
}
else
{
MessageBox
.
Show
(
"获取图片失败"
);
return
;
}
}
GC
.
Collect
();
Image
file
=
(
Image
)
Image
.
FromFile
(
filePath
+
fileName
);
...
...
@@ -163,7 +168,7 @@ namespace AccAOI
btnImageChange_Click
(
null
,
null
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
"btnGetCameraImg_Click Error:"
+
ex
.
ToString
());
MessageBox
.
Show
(
ex
.
ToString
());
...
...
@@ -318,7 +323,7 @@ namespace AccAOI
aoiControl
.
FormBorderStyle
=
FormBorderStyle
.
None
;
aoiControl
.
StartPosition
=
FormStartPosition
.
CenterParent
;
aoiControl
.
Location
=
new
Point
(
0
,
0
);
aoiControl
.
BImageBox
=
this
.
imageBox1
;
aoiControl
.
BImageBox
=
this
.
imageBox1
;
aoiControl
.
AoiInfo
=
method
;
aoiControl
.
Size
=
panAoi
.
Size
;
aoiControl
.
TitleName
=
method
.
MethodName
;
...
...
@@ -332,14 +337,14 @@ namespace AccAOI
//Image threshImage = CutImage(imageBox1.Image, currPath);
//cutImage = threshImage;
aoiControl
.
SetCurrPath
(
currPath
,
true
);
aoiControl
.
SetCurrPath
(
currPath
,
true
);
}
aoiControl
.
Show
();
aoiControl
.
ShowAoiInfo
();
}
private
void
SaveCurrAoi
()
{
if
(
aoiControl
!=
null
&&
aoiControl
.
Visible
)
if
(
aoiControl
!=
null
&&
aoiControl
.
Visible
)
{
AoiMethod
method
=
aoiControl
.
GetAoiInfo
();
...
...
@@ -383,7 +388,8 @@ namespace AccAOI
{
aoiList
.
Index
=
index
;
ShowAoi
(
Project
.
methodMap
[
key
]);
}
index
++;
}
index
++;
}
}
if
(
imageBox1
.
Visible
.
Equals
(
false
))
...
...
@@ -435,8 +441,9 @@ namespace AccAOI
}
currPath
=
imageBox1
.
SelectionRegion
;
aoiControl
.
SetCurrPath
(
currPath
);
}
catch
(
Exception
ex
)
aoiControl
.
SetCurrPath
(
currPath
);
}
catch
(
Exception
ex
)
{
}
...
...
@@ -486,7 +493,7 @@ namespace AccAOI
}
if
(
this
.
aoiControl
!=
null
)
{
DialogResult
result
=
MessageBox
.
Show
(
"确定删除 "
+
aoiControl
.
AoiInfo
.
MethodName
+
" ?"
,
"确认提示"
,
MessageBoxButtons
.
OKCancel
);
DialogResult
result
=
MessageBox
.
Show
(
"确定删除 "
+
aoiControl
.
AoiInfo
.
MethodName
+
" ?"
,
"确认提示"
,
MessageBoxButtons
.
OKCancel
);
if
(
result
.
Equals
(
DialogResult
.
OK
))
{
if
(
Project
.
methodMap
.
ContainsKey
(
aoiControl
.
AoiInfo
.
MethodName
))
...
...
@@ -561,11 +568,32 @@ namespace AccAOI
MessageBox
.
Show
(
"清先选择相机"
);
return
;
}
Bitmap
img
=
CameraManager
.
GetCamerImage
(
camera
);
string
filePath
=
Application
.
StartupPath
+
@"\aimage\"
;
string
fileName
=
@"\test.bmp"
;
using
(
Bitmap
img
=
CameraManager
.
GetCamerImage
(
camera
))
{
if
(
img
!=
null
)
{
string
path
=
Path
.
GetFullPath
(
filePath
);
if
(!
Directory
.
Exists
(
path
))
{
Directory
.
CreateDirectory
(
path
);
}
img
.
Save
(
filePath
+
fileName
,
ImageFormat
.
Bmp
);
}
else
{
MessageBox
.
Show
(
"获取图片失败"
);
return
;
}
}
GC
.
Collect
();
Image
file
=
(
Image
)
Image
.
FromFile
(
filePath
+
fileName
);
TestImage
=
new
Bitmap
(
file
);
file
.
Dispose
();
//读取图片内容
TestImage
=
(
Image
)
img
.
Clone
();
testImageBox1
.
Image
=
TestImage
;
if
(
testImageBox1
.
Visible
.
Equals
(
false
))
{
...
...
@@ -573,5 +601,4 @@ namespace AccAOI
}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论