Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit ef768e00
由
LN
编写于
2022-03-04 13:24:00 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
磁盘空间大于5G时才保存皮带线图片
1 个父辈
d26cf840
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
71 行增加
和
12 行删除
source/DeviceLibrary/deviceLibrary/reelCheck/ReelCheckUtil.cs
source/DeviceLibrary/deviceLibrary/reelCheck/ReelCheckUtil.cs
查看文件 @
ef768e0
...
...
@@ -93,15 +93,15 @@ dMinorStep 步进,默认1.0。
}
string
date
=
cameraName
.
Trim
().
Replace
(
'_'
,
'-'
)
+
"-"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd-HHmmss"
)
+
DateTime
.
Now
.
Millisecond
;
string
imageName
=
date
+
".bmp"
;
if
(
SaveImage
)
{
string
path
=
"D:\\image\\"
+
cameraName
+
"\\SourceImg\\"
;
if
(!
Directory
.
Exists
(
path
))
{
Directory
.
CreateDirectory
(
path
);
}
bitmap
.
Save
(
path
+
imageName
,
ImageFormat
.
Bmp
);
}
//
if (SaveImage)
//
{
//
string path = "D:\\image\\"+ cameraName + "\\SourceImg\\";
//
if (!Directory.Exists(path))
//
{
//
Directory.CreateDirectory(path);
//
}
//
bitmap.Save(path + imageName, ImageFormat.Bmp);
//
}
EyemImage
image
=
eyemCvtToEyemImage
(
bitmap
);
//绿色分割模型
EyemHSVModel
tpHsvModel
=
new
EyemHSVModel
();
...
...
@@ -145,12 +145,35 @@ dMinorStep 步进,默认1.0。
Bitmap
dstBitmap
=
eyemCvtToBitmap
(
tpDstImg
);
if
(
dstBitmap
!=
null
&&
SaveImage
)
{
//两个工位只有一个料盘时才保存图片
//bool save = false;
//if (ipResults != null && ipResults.Length == 2)
//{
// if ((ipResults[0] == 0) || (ipResults[0] == 1))
// {
// save = true;
// }
// else if ((ipResults[0] == 1) || (ipResults[0] == 0))
// {
// save = true;
// }
//}
//else
//{
// save = true;
//}
//if (save)
//{
string
path
=
"D:\\image\\"
+
cameraName
+
"\\ResOut\\"
;
if
(!
Directory
.
Exists
(
path
))
//if (!Directory.Exists(path))
//{
// Directory.CreateDirectory(path);
//}
if
(
canSavePic
(
path
))
{
Directory
.
CreateDirectory
(
path
);
dstBitmap
.
Save
(
path
+
imageName
,
ImageFormat
.
Jpeg
);
}
dstBitmap
.
Save
(
path
+
imageName
,
ImageFormat
.
Bmp
);
//}
}
//释放资源
Marshal
.
FreeHGlobal
(
hGlobal
);
...
...
@@ -162,6 +185,42 @@ dMinorStep 步进,默认1.0。
return
ipResults
;
}
public
static
bool
canSavePic
(
string
path
=
""
)
{
if
(
path
==
""
)
{
path
=
"D:\\image\\ResOut\\"
;
}
if
(!
Directory
.
Exists
(
path
))
{
Directory
.
CreateDirectory
(
path
);
}
string
volume
=
path
.
Substring
(
0
,
path
.
IndexOf
(
':'
));
long
freespace
=
GetHardDiskSpace
(
volume
);
int
zhao
=(
int
)(
freespace
/
1024
);
if
(
zhao
<
5
)
{
LogUtil
.
error
(
volume
+
"盘剩余空间:"
+
freespace
+
"M, 不再保存料盘图片"
);
return
false
;
}
return
true
;
}
//单位MB
private
static
long
GetHardDiskSpace
(
string
str_HardDiskName
)
{
long
totalSize
=
0
;
str_HardDiskName
=
str_HardDiskName
+
":\\"
;
System
.
IO
.
DriveInfo
[]
drives
=
System
.
IO
.
DriveInfo
.
GetDrives
();
foreach
(
System
.
IO
.
DriveInfo
drive
in
drives
)
{
if
(
drive
.
Name
==
str_HardDiskName
)
{
totalSize
=
drive
.
TotalFreeSpace
/
(
1024
*
1024
);
}
}
return
totalSize
;
}
public
static
EyemImage
eyemCvtToEyemImage
(
Bitmap
bitmap
)
{
EyemImage
tpImage
=
new
EyemImage
();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论