Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
GeneralClassLibrary
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7ce5a30d
由
LN
编写于
2020-03-11 18:12:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
相机获取图片修改
1 个父辈
ca0df4ec
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
353 行增加
和
44 行删除
CodeLibraryProject/CodeLibrary/CodeLibrary.csproj
CodeLibraryProject/CodeLibrary/FrmCodeDecode.Designer.cs
CodeLibraryProject/CodeLibrary/FrmCodeDecode.cs
CodeLibraryProject/CodeLibrary/FrmCodeLearn.cs
CodeLibraryProject/CodeLibrary/HDCodeHelper.cs
CodeLibraryProject/CodeLibrary/HDLogUtil.cs
CodeLibraryProject/CodeLibrary/camera/Basler.cs
CodeLibraryProject/CodeLibrary/camera/Common.cs
CodeLibraryProject/CodeLibrary/camera/HIK.cs
CodeLibraryProject/CodeTest/CodeCreater.cs
CodeLibraryProject/CodeTest/Program.cs
dll/CodeLibrary.dll
CodeLibraryProject/CodeLibrary/CodeLibrary.csproj
查看文件 @
7ce5a30
...
@@ -57,14 +57,15 @@
...
@@ -57,14 +57,15 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="camera\Basler.cs" />
<Compile Include="camera\Common.cs" />
<Compile Include="camera\HIK.cs" />
<Compile Include="FrmBase.cs">
<Compile Include="FrmBase.cs">
<SubType>Form</SubType>
<SubType>Form</SubType>
</Compile>
</Compile>
<Compile Include="FrmBase.Designer.cs">
<Compile Include="FrmBase.Designer.cs">
<DependentUpon>FrmBase.cs</DependentUpon>
<DependentUpon>FrmBase.cs</DependentUpon>
</Compile>
</Compile>
<Compile Include="HIKCamera.cs" />
<Compile Include="BaslerCamera.cs" />
<Compile Include="FrmCodeLearn.cs">
<Compile Include="FrmCodeLearn.cs">
<SubType>Form</SubType>
<SubType>Form</SubType>
</Compile>
</Compile>
...
...
CodeLibraryProject/CodeLibrary/FrmCodeDecode.Designer.cs
查看文件 @
7ce5a30
...
@@ -55,13 +55,14 @@
...
@@ -55,13 +55,14 @@
this
.
label4
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label4
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
btnLight
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnLight
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnScanTest
=
new
System
.
Windows
.
Forms
.
Button
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
BeginInit
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
// txtPath
// txtPath
//
//
this
.
txtPath
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
txtPath
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
txtPath
.
Location
=
new
System
.
Drawing
.
Point
(
864
,
92
);
this
.
txtPath
.
Location
=
new
System
.
Drawing
.
Point
(
1047
,
92
);
this
.
txtPath
.
Name
=
"txtPath"
;
this
.
txtPath
.
Name
=
"txtPath"
;
this
.
txtPath
.
Size
=
new
System
.
Drawing
.
Size
(
321
,
21
);
this
.
txtPath
.
Size
=
new
System
.
Drawing
.
Size
(
321
,
21
);
this
.
txtPath
.
TabIndex
=
0
;
this
.
txtPath
.
TabIndex
=
0
;
...
@@ -82,7 +83,7 @@
...
@@ -82,7 +83,7 @@
this
.
pictureBox1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
this
.
pictureBox1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
pictureBox1
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
pictureBox1
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
734
,
115
);
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
917
,
115
);
this
.
pictureBox1
.
Name
=
"pictureBox1"
;
this
.
pictureBox1
.
Name
=
"pictureBox1"
;
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
451
,
313
);
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
451
,
313
);
this
.
pictureBox1
.
SizeMode
=
System
.
Windows
.
Forms
.
PictureBoxSizeMode
.
Zoom
;
this
.
pictureBox1
.
SizeMode
=
System
.
Windows
.
Forms
.
PictureBoxSizeMode
.
Zoom
;
...
@@ -92,7 +93,7 @@
...
@@ -92,7 +93,7 @@
// txtResult
// txtResult
//
//
this
.
txtResult
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
txtResult
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
txtResult
.
Location
=
new
System
.
Drawing
.
Point
(
734
,
431
);
this
.
txtResult
.
Location
=
new
System
.
Drawing
.
Point
(
917
,
431
);
this
.
txtResult
.
Multiline
=
true
;
this
.
txtResult
.
Multiline
=
true
;
this
.
txtResult
.
Name
=
"txtResult"
;
this
.
txtResult
.
Name
=
"txtResult"
;
this
.
txtResult
.
Size
=
new
System
.
Drawing
.
Size
(
450
,
290
);
this
.
txtResult
.
Size
=
new
System
.
Drawing
.
Size
(
450
,
290
);
...
@@ -132,9 +133,9 @@
...
@@ -132,9 +133,9 @@
this
.
hWindowControl1
.
ImagePart
=
new
System
.
Drawing
.
Rectangle
(
0
,
0
,
640
,
480
);
this
.
hWindowControl1
.
ImagePart
=
new
System
.
Drawing
.
Rectangle
(
0
,
0
,
640
,
480
);
this
.
hWindowControl1
.
Location
=
new
System
.
Drawing
.
Point
(
11
,
115
);
this
.
hWindowControl1
.
Location
=
new
System
.
Drawing
.
Point
(
11
,
115
);
this
.
hWindowControl1
.
Name
=
"hWindowControl1"
;
this
.
hWindowControl1
.
Name
=
"hWindowControl1"
;
this
.
hWindowControl1
.
Size
=
new
System
.
Drawing
.
Size
(
717
,
606
);
this
.
hWindowControl1
.
Size
=
new
System
.
Drawing
.
Size
(
900
,
606
);
this
.
hWindowControl1
.
TabIndex
=
8
;
this
.
hWindowControl1
.
TabIndex
=
8
;
this
.
hWindowControl1
.
WindowSize
=
new
System
.
Drawing
.
Size
(
717
,
606
);
this
.
hWindowControl1
.
WindowSize
=
new
System
.
Drawing
.
Size
(
900
,
606
);
//
//
// btnbarCode
// btnbarCode
//
//
...
@@ -151,7 +152,7 @@
...
@@ -151,7 +152,7 @@
//
//
this
.
btnLearn
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnLearn
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnLearn
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnLearn
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnLearn
.
Location
=
new
System
.
Drawing
.
Point
(
1
066
,
12
);
this
.
btnLearn
.
Location
=
new
System
.
Drawing
.
Point
(
1
249
,
12
);
this
.
btnLearn
.
Name
=
"btnLearn"
;
this
.
btnLearn
.
Name
=
"btnLearn"
;
this
.
btnLearn
.
Size
=
new
System
.
Drawing
.
Size
(
109
,
33
);
this
.
btnLearn
.
Size
=
new
System
.
Drawing
.
Size
(
109
,
33
);
this
.
btnLearn
.
TabIndex
=
10
;
this
.
btnLearn
.
TabIndex
=
10
;
...
@@ -238,7 +239,7 @@
...
@@ -238,7 +239,7 @@
//
//
this
.
btnExit
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnExit
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnExit
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnExit
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnExit
.
Location
=
new
System
.
Drawing
.
Point
(
1
066
,
50
);
this
.
btnExit
.
Location
=
new
System
.
Drawing
.
Point
(
1
249
,
50
);
this
.
btnExit
.
Name
=
"btnExit"
;
this
.
btnExit
.
Name
=
"btnExit"
;
this
.
btnExit
.
Size
=
new
System
.
Drawing
.
Size
(
109
,
33
);
this
.
btnExit
.
Size
=
new
System
.
Drawing
.
Size
(
109
,
33
);
this
.
btnExit
.
TabIndex
=
18
;
this
.
btnExit
.
TabIndex
=
18
;
...
@@ -250,7 +251,7 @@
...
@@ -250,7 +251,7 @@
//
//
this
.
label1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
label1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
label1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
731
,
95
);
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
914
,
95
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
127
,
17
);
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
127
,
17
);
this
.
label1
.
TabIndex
=
19
;
this
.
label1
.
TabIndex
=
19
;
...
@@ -330,7 +331,7 @@
...
@@ -330,7 +331,7 @@
this
.
txtParamPath
.
Enabled
=
false
;
this
.
txtParamPath
.
Enabled
=
false
;
this
.
txtParamPath
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
92
);
this
.
txtParamPath
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
92
);
this
.
txtParamPath
.
Name
=
"txtParamPath"
;
this
.
txtParamPath
.
Name
=
"txtParamPath"
;
this
.
txtParamPath
.
Size
=
new
System
.
Drawing
.
Size
(
523
,
21
);
this
.
txtParamPath
.
Size
=
new
System
.
Drawing
.
Size
(
706
,
21
);
this
.
txtParamPath
.
TabIndex
=
28
;
this
.
txtParamPath
.
TabIndex
=
28
;
//
//
// label4
// label4
...
@@ -367,11 +368,23 @@
...
@@ -367,11 +368,23 @@
this
.
button1
.
Visible
=
false
;
this
.
button1
.
Visible
=
false
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
//
// btnScanTest
//
this
.
btnScanTest
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnScanTest
.
Location
=
new
System
.
Drawing
.
Point
(
1069
,
12
);
this
.
btnScanTest
.
Name
=
"btnScanTest"
;
this
.
btnScanTest
.
Size
=
new
System
.
Drawing
.
Size
(
167
,
33
);
this
.
btnScanTest
.
TabIndex
=
30
;
this
.
btnScanTest
.
Text
=
"扫码测试"
;
this
.
btnScanTest
.
UseVisualStyleBackColor
=
true
;
this
.
btnScanTest
.
Click
+=
new
System
.
EventHandler
(
this
.
btnScanTest_Click
);
//
// FrmCodeDecode
// FrmCodeDecode
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1192
,
729
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1375
,
729
);
this
.
Controls
.
Add
(
this
.
btnScanTest
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
txtParamPath
);
this
.
Controls
.
Add
(
this
.
txtParamPath
);
this
.
Controls
.
Add
(
this
.
label4
);
this
.
Controls
.
Add
(
this
.
label4
);
...
@@ -403,6 +416,7 @@
...
@@ -403,6 +416,7 @@
this
.
Name
=
"FrmCodeDecode"
;
this
.
Name
=
"FrmCodeDecode"
;
this
.
Text
=
"二维码识别"
;
this
.
Text
=
"二维码识别"
;
this
.
WindowState
=
System
.
Windows
.
Forms
.
FormWindowState
.
Maximized
;
this
.
WindowState
=
System
.
Windows
.
Forms
.
FormWindowState
.
Maximized
;
this
.
FormClosing
+=
new
System
.
Windows
.
Forms
.
FormClosingEventHandler
(
this
.
FrmCodeDecode_FormClosing
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmMain_Load
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmMain_Load
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
...
@@ -438,6 +452,7 @@
...
@@ -438,6 +452,7 @@
private
System
.
Windows
.
Forms
.
Label
label4
;
private
System
.
Windows
.
Forms
.
Label
label4
;
private
System
.
Windows
.
Forms
.
Button
btnLight
;
private
System
.
Windows
.
Forms
.
Button
btnLight
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
Button
btnScanTest
;
}
}
}
}
CodeLibraryProject/CodeLibrary/FrmCodeDecode.cs
查看文件 @
7ce5a30
此文件的差异被折叠,
点击展开。
CodeLibraryProject/CodeLibrary/FrmCodeLearn.cs
查看文件 @
7ce5a30
...
@@ -37,20 +37,21 @@ namespace CodeLibrary
...
@@ -37,20 +37,21 @@ namespace CodeLibrary
MessageBox
.
Show
(
selCamera
);
MessageBox
.
Show
(
selCamera
);
return
null
;
return
null
;
}
}
if
(
baslerNameList
.
Contains
(
camerName
))
//if (baslerNameList.Contains(camerName))
{
//{
BaslerCamera
.
Instance
.
Open
(
camerName
);
// BaslerCamera.Instance.Open(camerName);
BaslerCamera
.
Instance
.
GrabOne
();
// BaslerCamera.Instance.GrabOne();
bitmap
=
BaslerCamera
.
Instance
.
Image
;
// bitmap = BaslerCamera.Instance.Image;
BaslerCamera
.
Instance
.
Close
();
// BaslerCamera.Instance.Close();
}
//}
else
//else
{
//{
HIKCamera
.
Instance
.
Open
(
camerName
);
// HIKCamera.Instance.Open(camerName);
HIKCamera
.
Instance
.
GrabOne
();
// HIKCamera.Instance.GrabOne();
bitmap
=
HIKCamera
.
Instance
.
Image
;
// bitmap = HIKCamera.Instance.Image;
HIKCamera
.
Instance
.
Close
();
// HIKCamera.Instance.Close();
}
//}
bitmap
=
Camera
.
_cam
.
GrabOneImage
(
camerName
);
return
bitmap
;
return
bitmap
;
}
}
private
void
btnOpen_Click
(
object
sender
,
EventArgs
e
)
private
void
btnOpen_Click
(
object
sender
,
EventArgs
e
)
...
@@ -106,21 +107,21 @@ namespace CodeLibrary
...
@@ -106,21 +107,21 @@ namespace CodeLibrary
}
}
private
void
LoadCamera
()
private
void
LoadCamera
()
{
{
string
[]
camerName
=
BaslerCamera
.
Instance
.
CameraName
;
//
string[] camerName = BaslerCamera.Instance.CameraName;
baslerNameList
.
AddRange
(
camerName
);
//
baslerNameList.AddRange(camerName);
cmbCamera
.
Items
.
Clear
();
cmbCamera
.
Items
.
Clear
();
foreach
(
string
str
in
camer
Name
)
foreach
(
string
str
in
Camera
.
_cam
.
Name
)
{
{
cmbCamera
.
Items
.
Add
(
str
);
cmbCamera
.
Items
.
Add
(
str
);
}
}
camerName
=
HIKCamera
.
Instance
.
CameraName
;
//
camerName = HIKCamera.Instance.CameraName;
hikNameList
.
AddRange
(
camerName
);
//
hikNameList.AddRange(camerName);
foreach
(
string
str
in
camerName
)
//
foreach (string str in camerName)
{
//
{
cmbCamera
.
Items
.
Add
(
str
);
//
cmbCamera.Items.Add(str);
}
//
}
if
(
c
amerName
.
Length
>
0
)
if
(
c
mbCamera
.
Items
.
Count
>
0
)
{
{
cmbCamera
.
SelectedIndex
=
0
;
cmbCamera
.
SelectedIndex
=
0
;
}
}
...
...
CodeLibraryProject/CodeLibrary/HDCodeHelper.cs
查看文件 @
7ce5a30
...
@@ -80,6 +80,7 @@ namespace CodeLibrary
...
@@ -80,6 +80,7 @@ namespace CodeLibrary
}
}
public
static
List
<
CodeInfo
>
DecodeCode
(
HObject
ho_Image
,
string
symbolType
,
string
hv_model_path
,
int
codeCount
)
public
static
List
<
CodeInfo
>
DecodeCode
(
HObject
ho_Image
,
string
symbolType
,
string
hv_model_path
,
int
codeCount
)
{
{
HDLogUtil
.
info
(
" DecodeCode["
+
symbolType
+
"]["
+
hv_model_path
+
"]["
+
codeCount
+
"] 开始"
);
List
<
CodeInfo
>
codeList
=
new
List
<
CodeInfo
>();
List
<
CodeInfo
>
codeList
=
new
List
<
CodeInfo
>();
try
try
{
{
...
@@ -137,12 +138,14 @@ namespace CodeLibrary
...
@@ -137,12 +138,14 @@ namespace CodeLibrary
HDLogUtil
.
error
(
"处理二维码出错:索引="
+
i
+
","
+
resultList
.
ToString
());
HDLogUtil
.
error
(
"处理二维码出错:索引="
+
i
+
","
+
resultList
.
ToString
());
}
}
}
}
}
}
HDLogUtil
.
info
(
" DecodeCode["
+
symbolType
+
"]["
+
hv_model_path
+
"]["
+
codeCount
+
"] 结束,返回数量:"
+
codeList
.
Count
);
return
codeList
;
return
codeList
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
HDLogUtil
.
error
(
"DecodeCode出错:"
+
ex
.
ToString
());
HDLogUtil
.
error
(
"DecodeCode出错:"
+
ex
.
ToString
());
HDLogUtil
.
info
(
" DecodeCode["
+
symbolType
+
"]["
+
hv_model_path
+
"]["
+
codeCount
+
"] 结束,返回数量:"
+
codeList
.
Count
);
return
codeList
;
return
codeList
;
}
}
...
@@ -195,7 +198,7 @@ namespace CodeLibrary
...
@@ -195,7 +198,7 @@ namespace CodeLibrary
ho_Image
.
Dispose
();
ho_Image
.
Dispose
();
Rectangle
rect
=
new
Rectangle
(
0
,
0
,
bmp
.
Width
,
bmp
.
Height
);
Rectangle
rect
=
new
Rectangle
(
0
,
0
,
bmp
.
Width
,
bmp
.
Height
);
BitmapData
srcBmpData
=
bmp
.
LockBits
(
rect
,
ImageLockMode
.
ReadOnly
,
PixelFormat
.
Format32bppRgb
);
BitmapData
srcBmpData
=
bmp
.
LockBits
(
rect
,
ImageLockMode
.
ReadOnly
,
bmp
.
PixelFormat
);
HOperatorSet
.
GenImageInterleaved
(
out
ho_Image
,
srcBmpData
.
Scan0
,
"bgrx"
,
bmp
.
Width
,
bmp
.
Height
,
0
,
"byte"
,
0
,
0
,
0
,
0
,
-
1
,
0
);
HOperatorSet
.
GenImageInterleaved
(
out
ho_Image
,
srcBmpData
.
Scan0
,
"bgrx"
,
bmp
.
Width
,
bmp
.
Height
,
0
,
"byte"
,
0
,
0
,
0
,
0
,
-
1
,
0
);
bmp
.
UnlockBits
(
srcBmpData
);
bmp
.
UnlockBits
(
srcBmpData
);
...
...
CodeLibraryProject/CodeLibrary/HDLogUtil.cs
查看文件 @
7ce5a30
...
@@ -34,12 +34,12 @@ namespace CodeLibrary
...
@@ -34,12 +34,12 @@ namespace CodeLibrary
public
static
void
info
(
string
msg
)
public
static
void
info
(
string
msg
)
{
{
LOGGER
.
Info
(
LOGGER
.
Logger
.
Name
+
" - "
+
msg
);
LOGGER
.
Info
(
"HDLogUtil"
+
" - "
+
msg
);
AddToBox
(
msg
);
AddToBox
(
msg
);
}
}
public
static
void
debug
(
string
msg
)
public
static
void
debug
(
string
msg
)
{
{
LOGGER
.
Debug
(
LOGGER
.
Logger
.
Name
+
" - "
+
msg
);
LOGGER
.
Debug
(
"HDLogUtil"
+
" - "
+
msg
);
if
(
debug_opened
)
if
(
debug_opened
)
{
{
AddToBox
(
msg
);
AddToBox
(
msg
);
...
@@ -48,7 +48,7 @@ namespace CodeLibrary
...
@@ -48,7 +48,7 @@ namespace CodeLibrary
public
static
void
error
(
string
errorMsg
)
public
static
void
error
(
string
errorMsg
)
{
{
LOGGER
.
Error
(
LOGGER
.
Logger
.
Name
+
" - "
+
errorMsg
);
LOGGER
.
Error
(
"HDLogUtil"
+
" - "
+
errorMsg
);
AddToBox
(
errorMsg
);
AddToBox
(
errorMsg
);
}
}
private
static
void
AddToBox
(
string
msg
)
private
static
void
AddToBox
(
string
msg
)
...
...
CodeLibraryProject/CodeLibrary/camera/Basler.cs
0 → 100644
查看文件 @
7ce5a30
此文件的差异被折叠,
点击展开。
CodeLibraryProject/CodeLibrary/camera/Common.cs
0 → 100644
查看文件 @
7ce5a30
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
namespace
CodeLibrary
{
/// <summary>
/// 相机
/// </summary>
public
class
Camera
:
ClsCamera
{
public
static
ClsCamera
_cam
;
private
static
CameraType
_type
;
/// <summary>
/// 连续采集事件
/// </summary>
public
static
event
Continuous
Continuous_Event
;
/// <summary>
/// 相机
/// </summary>
private
Camera
()
{
}
/// <summary>
/// 相机类型
/// </summary>
public
static
CameraType
Type
{
set
{
if
(
_cam
!=
null
)
{
return
;
// _cam.CloseAll();
}
_type
=
value
;
switch
(
_type
)
{
case
CameraType
.
HIK
:
_cam
=
new
HIK
();
((
HIK
)
_cam
).
Continuous_Event
+=
Camera_Continuous_Event
;
break
;
case
CameraType
.
Basler
:
_cam
=
new
Basler
();
((
Basler
)
_cam
).
Continuous_Event
+=
Camera_Continuous_Event
;
break
;
}
}
get
{
return
_type
;
}
}
/// <summary>
/// 错误信息
/// </summary>
public
override
string
ErrInfo
=>
_cam
.
ErrInfo
;
/// <summary>
/// 相机是否打开
/// </summary>
public
override
bool
[]
IsOpen
=>
_cam
.
IsOpen
;
/// <summary>
/// 相机总数
/// </summary>
public
override
int
Count
=>
_cam
.
Count
;
/// <summary>
/// 相机名称
/// </summary>
public
override
string
[]
Name
=>
_cam
.
Name
;
/// <summary>
/// 图像宽度
/// </summary>
public
override
int
[]
Width
=>
_cam
.
Width
;
/// <summary>
/// 图像高度
/// </summary>
public
override
int
[]
Height
=>
_cam
.
Height
;
/// <summary>
/// 图像缓存
/// </summary>
public
override
byte
[]
Buffer
=>
_cam
.
Buffer
;
/// <summary>
/// 图像
/// </summary>
public
override
Bitmap
Image
=>
_cam
.
Image
;
/// <summary>
/// 加载
/// </summary>
/// <returns></returns>
public
override
bool
Load
()
{
if
(
_cam
==
null
)
return
false
;
else
return
_cam
.
Load
();
}
/// <summary>
/// 打开相机
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public
override
bool
Open
(
int
index
)
{
return
_cam
.
Open
(
index
);
}
/// <summary>
/// 打开相机
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public
override
bool
Open
(
string
name
)
{
return
_cam
.
Open
(
name
);
}
/// <summary>
/// 打开所有相机
/// </summary>
/// <returns></returns>
public
override
bool
OpenAll
()
{
return
_cam
.
OpenAll
();
}
///// <summary>
///// 连续抓取图像
///// </summary>
///// <returns></returns>
//public override bool GrabContinuous(int index)
//{
// return _cam.GrabContinuous( index);
//}
/// <summary>
/// 抓取一次图像
/// </summary>
/// <returns></returns>
public
override
bool
GrabOne
(
int
index
)
{
return
_cam
.
GrabOne
(
index
);
}
///// <summary>
///// 抓取一次图像
///// </summary>
///// <param name="index"></param>
///// <returns></returns>
//public override bool GrabOne(int index)
//{
// return _cam.GrabOne(index);
//}
/// <summary>
/// 抓取一次图像
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public
override
bool
GrabOne
(
string
name
)
{
return
_cam
.
GrabOne
(
name
);
}
/// <summary>
/// 停止连续抓取
/// </summary>
public
override
void
GrabStop
(
int
index
)
{
_cam
.
GrabStop
(
index
);
}
/// <summary>
/// 关闭所有相机
/// </summary>
public
override
void
CloseAll
()
{
_cam
.
CloseAll
();
}
/// <summary>
/// 关闭相机
/// </summary>
public
override
void
Close
(
int
index
)
{
_cam
.
Close
(
index
);
}
public
override
void
Close
(
string
name
)
{
_cam
.
Close
(
name
);
}
private
static
void
Camera_Continuous_Event
()
{
Continuous_Event
?.
Invoke
();
}
public
override
Bitmap
GrabOneImage
(
string
name
)
{
return
_cam
.
GrabOneImage
(
name
);
}
}
/// <summary>
/// 相机类型
/// </summary>
public
enum
CameraType
{
/// <summary>
/// 海康
/// </summary>
HIK
,
/// <summary>
/// Basle
/// </summary>
Basler
}
public
abstract
class
ClsCamera
{
/// <summary>
/// 所有相机的名称
/// </summary>
protected
List
<
string
>
cameraName
;
protected
string
_errInfo
;
protected
bool
[]
_isOpen
;
protected
int
_count
;
protected
string
[]
_name
;
protected
int
[]
_width
;
protected
int
[]
_height
;
protected
byte
[]
_buffer
;
protected
Bitmap
_image
;
// protected int _index;
public
delegate
void
Continuous
();
public
virtual
string
ErrInfo
=>
_errInfo
;
public
virtual
bool
[]
IsOpen
=>
_isOpen
;
public
virtual
int
Count
=>
_count
;
public
virtual
string
[]
Name
=>
_name
;
public
virtual
int
[]
Width
=>
_width
;
public
virtual
int
[]
Height
=>
_height
;
public
virtual
byte
[]
Buffer
=>
_buffer
;
public
virtual
Bitmap
Image
=>
_image
;
public
abstract
bool
Load
();
public
abstract
bool
OpenAll
();
public
abstract
bool
Open
(
int
index
);
public
abstract
bool
Open
(
string
name
);
public
abstract
void
CloseAll
();
public
abstract
void
Close
(
int
index
);
public
abstract
void
Close
(
string
name
);
// public abstract bool GrabOne();
public
abstract
bool
GrabOne
(
int
index
);
public
abstract
bool
GrabOne
(
string
name
);
// public abstract bool GrabContinuous(int index);
public
abstract
void
GrabStop
(
int
index
);
public
abstract
Bitmap
GrabOneImage
(
string
name
);
}
}
CodeLibraryProject/CodeLibrary/camera/HIK.cs
0 → 100644
查看文件 @
7ce5a30
此文件的差异被折叠,
点击展开。
CodeLibraryProject/CodeTest/CodeCreater.cs
查看文件 @
7ce5a30
...
@@ -25,7 +25,7 @@ namespace CodeTest
...
@@ -25,7 +25,7 @@ namespace CodeTest
}
}
for
(
int
i
=
100000
;
i
<=
100000
+
count
;
i
++)
for
(
int
i
=
100000
;
i
<=
100000
+
count
;
i
++)
{
{
string
name
=
"
pn;"
+
i
.
ToString
().
PadLeft
(
6
,
'0'
)
+
";1000
"
;
string
name
=
"
TRAY"
+
i
.
ToString
().
PadLeft
(
6
,
'0'
)
+
"
"
;
Bitmap
map
=
ZXingCode
(
name
,
200
,
BarcodeFormat
.
QR_CODE
);
Bitmap
map
=
ZXingCode
(
name
,
200
,
BarcodeFormat
.
QR_CODE
);
if
(
map
!=
null
)
if
(
map
!=
null
)
{
{
...
...
CodeLibraryProject/CodeTest/Program.cs
查看文件 @
7ce5a30
...
@@ -18,12 +18,12 @@ namespace CodeTest
...
@@ -18,12 +18,12 @@ namespace CodeTest
[
STAThread
]
[
STAThread
]
static
void
Main
()
static
void
Main
()
{
{
//
CodeCreater.CreateCode(10
0);
//
CodeCreater.CreateCode(1
0);
Application
.
EnableVisualStyles
();
Application
.
EnableVisualStyles
();
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
SetCompatibleTextRenderingDefault
(
false
);
HDCodeLearnHelper
.
LoadConfig
(
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CameraName
),
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CodeType
));
HDCodeLearnHelper
.
LoadConfig
(
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CameraName
),
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CodeType
));
Application
.
Run
(
new
FrmCodeDecode
());
Application
.
Run
(
new
FrmCodeDecode
());
//Application.Run(new FrmTest());
//
//
Application.Run(new FrmTest());
}
}
}
}
...
...
dll/CodeLibrary.dll
0 → 100644
查看文件 @
7ce5a30
此文件类型无法预览
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论