Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张士柳
/
eyemLib
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5361861d
由
张士柳
编写于
2021-03-02 17:35:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
无
1 个父辈
37fb9c9a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
37 行增加
和
12 行删除
eyemLib-Sharp/EyemLib.cs
eyemLib/eyemBarCode.cpp
eyemLib/eyemEdge.h
eyemLib/eyemLib.h
eyemLib/eyemMisc.cpp
eyemLib/eyemMisc.h
eyemLib-Sharp/EyemLib.cs
查看文件 @
5361861
...
...
@@ -720,6 +720,9 @@ namespace eyemLib_Sharp
//异型器件(新版本)
[
DllImport
(
"eyemLib.dll"
,
CharSet
=
CharSet
.
None
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
private
static
extern
int
eyemCountObjectIrregularPartsE
(
EyemImage
tpImage
,
string
fileName
,
string
ccSubType
,
string
ccTplName
,
double
dMinScore
,
ref
string
pNumObj
,
out
EyemImage
tpDstImg
);
//创建模板匹配模型
[
DllImport
(
"eyemLib.dll"
,
CharSet
=
CharSet
.
None
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
private
static
extern
int
eyemCreateTemplateModel
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
string
ccTplName
);
//读码程序
[
DllImport
(
"eyemLib.dll"
,
CharSet
=
CharSet
.
None
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
private
static
extern
int
eyemDetectAndDecode
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
string
fileName
,
string
strCodeType
,
out
DataCodeHandle
hObject
,
out
EyemBarCode
*
tpResults
,
out
int
ipNum
,
bool
bUseNiBlack
,
int
iBlockSize
,
int
iRangeC
,
int
iSymbolMin
,
int
iSymbolMax
,
double
dScaleUpAndDown
=
0.5
,
double
dToleErr
=
0.5
,
double
dMinorStep
=
1.0
);
...
...
@@ -901,10 +904,19 @@ namespace eyemLib_Sharp
//eyemEdgesPixel(ucpImage, 15);
#
endregion
////EyemRect tpRoi = new EyemRect();
////tpRoi.iXs = 1231; tpRoi.iYs = 433;
////tpRoi.iWidth = 41;
////tpRoi.iHeight = 14;
EyemRect
tpRoi
=
new
EyemRect
();
tpRoi
.
iXs
=
tpRoi
.
iYs
=
0
;
tpRoi
.
iXs
=
0
;
tpRoi
.
iYs
=
0
;
tpRoi
.
iWidth
=
image
.
iWidth
;
tpRoi
.
iHeight
=
image
.
iHeight
;
//创建模板匹配模型
//flag = eyemCreateTemplateModel(image, tpRoi, "D://批量测试图像2//template.tpl");
//
string
pNumObj
=
""
;
string
file
=
fileName
.
Split
(
new
string
[]
{
"\\"
},
StringSplitOptions
.
RemoveEmptyEntries
)[
2
];
...
...
@@ -912,16 +924,25 @@ namespace eyemLib_Sharp
//eyemCountObject(image, file.Replace(".png", ""), 35, 0, 100, 5, ref pNumObj, out tpDstImg);
//eyemCountObjectIrregularParts(image, file.Replace(".png", ""), 0.1, "IP_LARGE_PARTS", 100, 7, ref pNumObj, out tpDstImg);
//eyemCountObjectE(image, fileName, ref pNumObj, out tpDstImg);
eyemCountObjectIrregularPartsE
(
image
,
file
.
Replace
(
".png"
,
""
),
"IP_LARGE_PARTS"
,
"D://批量测试图像2//template.png"
,
0.7
,
ref
pNumObj
,
out
tpDstImg
);
//int ipNum; EyemBarCode* tpResults;
//DataCodeHandle hObject;
//int iRes = eyemDetectAndDecode(image, tpRoi, file.Replace(".png", ""), "QR_CODE|DATA_MATRIX|CODE_39|CODE_128", out hObject, out tpResults, out ipNum, false, 11, 5, 128, 256, 0.5);
//for (int i = 0; i < ipNum; i++)
//{
// Console.WriteLine("类型:" + Marshal.PtrToStringAnsi(tpResults[i].hType) + ";坐标" + "[" + tpResults[i].iCenterX.ToString() + "," + tpResults[i].iCenterY.ToString() + "]" + ";角度:" + tpResults[i].dAngle.ToString("F4") + "," + ";内容:" + Marshal.PtrToStringAnsi(tpResults[i].hText) + "");
// Marshal.FreeCoTaskMem(tpResults[i].hText); Marshal.FreeCoTaskMem(tpResults[i].hType);
//}
//hObject.Dispose();
//eyemCountObjectIrregularPartsE(image, file.Replace(".png", ""), "IP_LARGE_PARTS", "D://批量测试图像2//template.png", 0.7, ref pNumObj, out tpDstImg);
//Bitmap bmp = eyemCvtToBitmap(tpDstImg);
//bmp.Save("D://ResOut//" + file);
//<解码测试
int
ipNum
;
EyemBarCode
*
tpResults
;
DataCodeHandle
hObject
;
int
iRes
=
eyemDetectAndDecode
(
image
,
tpRoi
,
file
.
Replace
(
".png"
,
""
),
"QR_CODE|DATA_MATRIX|CODE_39|CODE_128"
,
out
hObject
,
out
tpResults
,
out
ipNum
,
false
,
7
,
5
,
128
,
256
,
1d
);
for
(
int
i
=
0
;
i
<
ipNum
;
i
++)
{
Console
.
WriteLine
(
"类型:"
+
Marshal
.
PtrToStringAnsi
(
tpResults
[
i
].
hType
)
+
";坐标"
+
"["
+
tpResults
[
i
].
iCenterX
.
ToString
()
+
","
+
tpResults
[
i
].
iCenterY
.
ToString
()
+
"]"
+
";角度:"
+
tpResults
[
i
].
dAngle
.
ToString
(
"F4"
)
+
","
+
";内容:"
+
Marshal
.
PtrToStringAnsi
(
tpResults
[
i
].
hText
)
+
""
);
Marshal
.
FreeCoTaskMem
(
tpResults
[
i
].
hText
);
Marshal
.
FreeCoTaskMem
(
tpResults
[
i
].
hType
);
}
hObject
.
Dispose
();
sw
.
Stop
();
Console
.
WriteLine
(
"耗时:"
+
sw
.
ElapsedMilliseconds
.
ToString
()
+
",结果:"
+
pNumObj
);
//free image
...
...
eyemLib/eyemBarCode.cpp
查看文件 @
5361861
...
...
@@ -649,6 +649,9 @@ int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, const char *ccFileNam
if
(
src
.
empty
())
{
return
FUNC_IMAGE_NOT_EXIST
;
}
//转单通道图像
if
(
src
.
channels
()
!=
1
)
cv
::
cvtColor
(
src
,
src
,
cv
::
COLOR_BGR2GRAY
);
//提取ROI
src
=
src
(
cv
::
Rect
(
tpRoi
.
iXs
,
tpRoi
.
iYs
,
tpRoi
.
iWidth
,
tpRoi
.
iHeight
));
//图像原图备份
...
...
eyemLib/eyemEdge.h
查看文件 @
5361861
...
...
@@ -6,7 +6,6 @@
#define __EYEM_EDGE_H
#include "eyemLib.h"
#include "eyemGeneric.h"
...
...
eyemLib/eyemLib.h
查看文件 @
5361861
...
...
@@ -836,6 +836,7 @@ extern "C" {
EXPORTS
int
eyemCountObjectE
(
EyemImage
tpImage
,
const
char
*
fileName
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
const
char
*
fileName
,
double
dOffset
,
const
char
*
ccSubType
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularPartsE
(
EyemImage
tpImage
,
const
char
*
fileName
,
const
char
*
ccSubType
,
const
char
*
ccTplName
,
double
dMinScore
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCreateTemplateModel
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
ccTplName
);
EXPORTS
int
eyemTrackFeature
(
EyemImage
tpPrevImg
,
EyemImage
tpNextImg
,
EyemRect3
*
tpRois
,
int
iRoiNum
,
int
*
ipResults
);
EXPORTS
int
eyemAOIForTSAV
(
EyemImage
tpRefImg
,
EyemImage
tpNextImg
,
EyemRect3
*
tpRois
,
int
iRoiNum
);
...
...
eyemLib/eyemMisc.cpp
查看文件 @
5361861
此文件的差异被折叠,
点击展开。
eyemLib/eyemMisc.h
查看文件 @
5361861
...
...
@@ -6,6 +6,7 @@
#define __EYEM_MISC_H
#include <io.h>
#include <fstream>
#include <direct.h>
#include "eyemLib.h"
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论