Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
GeneralClassLibrary
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d5eb241b
由
LN
编写于
2020-08-31 15:13:43 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
hoimage改为直接返回方式
1 个父辈
df6b8e9d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
34 行增加
和
34 行删除
CodeLibraryProject/CodeLibrary/FrmCodeDecode.cs
CodeLibraryProject/CodeLibrary/FrmCodeLearn.cs
CodeLibraryProject/CodeLibrary/camera/Basler.cs
CodeLibraryProject/CodeLibrary/camera/Common.cs
CodeLibraryProject/CodeLibrary/camera/HIK.cs
CodeLibraryProject/CodeLibrary/FrmCodeDecode.cs
查看文件 @
d5eb241
...
...
@@ -305,11 +305,11 @@ namespace CodeLibrary
return
null
;
}
HObject
map
;
bool
result
=
Camera
.
_cam
.
CaptureOnImage
(
camerName
,
out
map
);
if
(
result
&&
map
==
null
)
map
=
Camera
.
_cam
.
CaptureOnImage
(
camerName
);
if
(
map
==
null
)
{
Camera
.
_cam
.
Close
(
camerName
);
result
=
Camera
.
_cam
.
CaptureOnImage
(
camerName
,
out
map
);
map
=
Camera
.
_cam
.
CaptureOnImage
(
camerName
);
}
return
map
;
}
...
...
@@ -552,15 +552,15 @@ namespace CodeLibrary
for
(
int
index
=
1
;
index
<=
whileCount
;
index
++)
{
task
=
Task
.
Factory
.
StartNew
(
delegate
{
//
task = Task.Factory.StartNew(delegate {
label5
.
Text
=
"扫码测试_"
+
index
;
HObject
ho_Image
=
null
;
try
HObject
ho_Image
=
null
;
try
{
ho_Image
=
Camera
.
_cam
.
CaptureOnImage
(
camerName
);
if
(
ho_Image
!=
null
)
{
bool
result
=
Camera
.
_cam
.
CaptureOnImage
(
camerName
,
out
ho_Image
);
if
(
result
&&
ho_Image
!=
null
)
{
//ClearPicImg();
// ShowImage(ho_Image);
HDLogUtil
.
info
(
" 相机【"
+
camerName
+
"】获取图片完成,开始扫码"
);
...
...
@@ -595,19 +595,19 @@ namespace CodeLibrary
HDLogUtil
.
error
(
"ScanDemo["
+
index
+
"]出错:"
+
ex
.
ToString
());
}
finally
{
if
(
ho_Image
!=
null
)
{
if
(
ho_Image
!=
null
)
{
ho_Image
.
Dispose
();
ho_Image
=
null
;
}
ho_Image
.
Dispose
();
ho_Image
=
null
;
}
}
});
task
.
Wait
();
//
});
//
task.Wait();
//GC.Collect();
//Thread.Sleep(100);
task
.
Dispose
();
//
task.Dispose();
Thread
.
Sleep
(
5
);
}
this
.
Enabled
=
true
;
...
...
CodeLibraryProject/CodeLibrary/FrmCodeLearn.cs
查看文件 @
d5eb241
...
...
@@ -37,8 +37,8 @@ namespace CodeLibrary
{
MessageBox
.
Show
(
selCamera
);
return
null
;
}
Camera
.
_cam
.
CaptureOnImage
(
camerName
,
out
ho_image
);
}
ho_image
=
Camera
.
_cam
.
CaptureOnImage
(
camerName
);
return
ho_image
;
}
private
void
btnOpen_Click
(
object
sender
,
EventArgs
e
)
...
...
CodeLibraryProject/CodeLibrary/camera/Basler.cs
查看文件 @
d5eb241
...
...
@@ -228,14 +228,14 @@ namespace CodeLibrary
}
return
null
;
}
public
override
bool
CaptureOnImage
(
string
name
,
out
HObject
hoImage
)
public
override
HObject
CaptureOnImage
(
string
name
)
{
hoImage
=
null
;
HObject
hoImage
=
null
;
int
index
=
cameraName
.
FindIndex
(
s
=>
s
==
name
);
if
(
index
==
-
1
)
{
_errInfo
=
name
+
"Not find"
;
return
false
;
return
hoImage
;
}
if
(
cameraCurr
[
index
]
!=
null
)
{
...
...
@@ -258,7 +258,7 @@ namespace CodeLibrary
if
(!
grabResult
.
IsValid
||
!
grabResult
.
GrabSucceeded
)
{
_errInfo
=
grabResult
.
ErrorDescription
;
return
false
;
return
hoImage
;
}
//相机像素数据
...
...
@@ -274,19 +274,19 @@ namespace CodeLibrary
if
(
hand
.
IsAllocated
)
hand
.
Free
();
_errInfo
=
"OK"
;
return
true
;
return
hoImage
;
}
}
catch
(
Exception
ex
)
{
_errInfo
=
ex
.
Message
;
return
false
;
return
hoImage
;
}
finally
{
// cameraCurr[index].MV_CC_StopGrabbing_NET();
}
return
false
;
return
hoImage
;
}
}
...
...
CodeLibraryProject/CodeLibrary/camera/Common.cs
查看文件 @
d5eb241
...
...
@@ -112,7 +112,7 @@ namespace CodeLibrary
// public abstract bool GrabContinuous(int index);
// public abstract void GrabStop(int index);
public
abstract
Bitmap
GrabOneImage
(
string
name
);
public
abstract
bool
CaptureOnImage
(
string
name
,
out
HObject
hoImage
);
public
abstract
HObject
CaptureOnImage
(
string
name
);
}
}
CodeLibraryProject/CodeLibrary/camera/HIK.cs
查看文件 @
d5eb241
...
...
@@ -342,15 +342,15 @@ namespace CodeLibrary
return
_image
;
}
}
public
override
bool
CaptureOnImage
(
string
name
,
out
HObject
hoImage
)
public
override
HObject
CaptureOnImage
(
string
name
)
{
hoImage
=
null
;
HObject
hoImage
=
null
;
int
index
=
cameraName
.
FindIndex
(
s
=>
s
==
name
);
if
(
index
==
-
1
)
{
_errInfo
=
name
+
"Not find"
;
HDLogUtil
.
error
(
"CaptureOnImage ["
+
name
+
"] error : "
+
_errInfo
);
return
false
;
return
hoImage
;
}
if
(
cameraCurr
[
index
]
!=
null
)
{
...
...
@@ -369,7 +369,7 @@ namespace CodeLibrary
{
_errInfo
=
"Can not grab one : "
+
rtn
;
HDLogUtil
.
error
(
"CaptureOnImage ["
+
name
+
"] error : "
+
_errInfo
);
return
false
;
return
hoImage
;
}
int
nRet
=
cameraCurr
[
index
].
MV_CC_GetImageBuffer_NET
(
ref
FrameInfo
,
1000
);
...
...
@@ -391,7 +391,7 @@ namespace CodeLibrary
}
}
//return ho_Imagetemp;
return
tru
e
;
return
hoImag
e
;
}
else
{
...
...
@@ -401,7 +401,7 @@ namespace CodeLibrary
catch
(
Exception
ex
)
{
_errInfo
=
ex
.
Message
;
return
false
;
return
hoImage
;
}
finally
{
...
...
@@ -415,7 +415,7 @@ namespace CodeLibrary
HDLogUtil
.
error
(
" ["
+
name
+
"] MV_CC_FreeImageBuffer_NET 出错:"
+
ex
.
ToString
());
}
}
return
false
;
return
hoImage
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论