Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张士柳
/
eyemLib
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 19dd9381
由
张士柳
编写于
2021-03-17 16:20:04 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
无
1 个父辈
c56e3788
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
22 行增加
和
25 行删除
eyemLib-Sharp/EyemLib.cs
eyemLib/eyemLib.h
eyemLib/eyemLib.rc
eyemLib/eyemMisc.cpp
eyemLib-Sharp/EyemLib.cs
查看文件 @
19dd938
...
...
@@ -710,10 +710,10 @@ namespace eyemLib_Sharp
#
region
项目
//普通器件
[
DllImport
(
"eyemLib.dll"
,
CharSet
=
CharSet
.
None
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
private
static
extern
int
eyemCountObject
(
EyemImage
tpImage
,
string
fileName
,
double
dOffset
,
int
iMinArea
,
int
iMaxArea
,
int
iWinSize
,
ref
string
pNumObj
,
out
EyemImage
tpDstImg
);
private
static
extern
int
eyemCountObject
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
string
fileName
,
double
dOffset
,
int
iMinArea
,
int
iMaxArea
,
int
iWinSize
,
ref
string
pNumObj
,
out
EyemImage
tpDstImg
);
//异型器件
[
DllImport
(
"eyemLib.dll"
,
CharSet
=
CharSet
.
None
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
private
static
extern
int
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
string
fileName
,
double
dOffset
,
string
strType
,
int
iMaxArea
,
int
iWinSize
,
ref
string
pNumObj
,
out
EyemImage
tpDstImg
);
private
static
extern
int
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
string
fileName
,
double
dOffset
,
string
strType
,
int
iMaxArea
,
int
iWinSize
,
ref
string
pNumObj
,
out
EyemImage
tpDstImg
);
//普通器件(新版本)
[
DllImport
(
"eyemLib.dll"
,
CharSet
=
CharSet
.
None
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
private
static
extern
int
eyemCountObjectE
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
string
fileName
,
ref
string
pNumObj
,
out
EyemImage
tpDstImg
);
...
...
@@ -946,9 +946,9 @@ namespace eyemLib_Sharp
eyemImageFree
(
ref
tpDstImg
);
//"IP_SMALL_PARTS","IP_LARGE_PARTS","IP_LONG_PARTS",""
//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
,
tpRoi
,
fileName
,
ref
pNumObj
,
out
tpDstImg
);
//eyemCountObject(image,
tpRoi,
file.Replace(".png", ""), 35, 0, 100, 5, ref pNumObj, out tpDstImg);
//eyemCountObjectIrregularParts(image,
tpRoi,
file.Replace(".png", ""), 0.1, "IP_LARGE_PARTS", 100, 7, ref pNumObj, out tpDstImg);
//
eyemCountObjectE(image, tpRoi, fileName, ref pNumObj, out tpDstImg);
eyemCountObjectIrregularPartsE
(
image
,
tpRoi
,
file
.
Replace
(
".png"
,
""
),
selectModel
,
ref
pNumObj
,
out
tpDstImg
);
Bitmap
bitmap
=
eyemCvtToBitmap
(
tpDstImg
);
...
...
eyemLib/eyemLib.h
查看文件 @
19dd938
...
...
@@ -832,9 +832,9 @@ extern "C" {
#endif
EXPORTS
int
eyemDetectAndDecode
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
ccFileName
,
const
char
*
ccCodeType
,
IntPtr
*
hObject
,
EyemBarCode
**
tpResult
,
int
*
ipNum
,
bool
bUseNiBlack
,
int
iBlockSize
,
const
int
iRangeC
,
int
iSymbolMin
,
int
iSymbolMax
,
double
dScaleUpAndDown
=
0
.
5
,
double
dToleErr
=
0
.
5
,
double
dMinorStep
=
1
.
0
);
EXPORTS
bool
eyemDetectAndDecodeFree
(
IntPtr
hObject
);
EXPORTS
int
eyemCountObject
(
EyemImage
tpImage
,
const
char
*
fileName
,
double
dOffset
,
int
iMinArea
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObject
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
double
dOffset
,
int
iMinArea
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectE
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
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
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
double
dOffset
,
const
char
*
ccSubType
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularPartsE
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
const
char
*
ccTplName
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemAchvTemplateImage
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCreateTemplateModel
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
double
dMinScore
,
const
char
*
ccTplName
);
...
...
eyemLib/eyemLib.rc
查看文件 @
19dd938
此文件类型无法预览
eyemLib/eyemMisc.cpp
查看文件 @
19dd938
...
...
@@ -569,7 +569,7 @@ static bool checkSize(cv::Mat &srcPrev, cv::Mat &mask, int &partSize)
#pragma endregion
int
eyemCountObject
(
EyemImage
tpImage
,
const
char
*
fileName
,
double
dOffset
,
int
iMinArea
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
)
int
eyemCountObject
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
double
dOffset
,
int
iMinArea
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
)
{
cv
::
Mat
src
=
cv
::
Mat
(
tpImage
.
iHeight
,
tpImage
.
iWidth
,
MAKETYPE
(
tpImage
.
iDepth
,
tpImage
.
iChannels
),
tpImage
.
vpImage
);
if
(
src
.
empty
())
{
...
...
@@ -579,11 +579,8 @@ int eyemCountObject(EyemImage tpImage, const char *fileName, double dOffset, int
if
(
src
.
channels
()
!=
1
)
cv
::
cvtColor
(
src
,
src
,
cv
::
COLOR_BGR2GRAY
);
cv
::
Mat
src8U
;
//环鸿&佳世达
src
=
src
(
cv
::
Range
(
200
,
src
.
cols
-
70
),
cv
::
Range
(
200
,
src
.
rows
-
10
)).
clone
();
//其他设备
//src = src(cv::Range(20, src.cols - 20), cv::Range(20, src.rows - 20)).clone();
//图像裁剪
src
=
src
(
cv
::
Rect
(
tpRoi
.
iXs
,
tpRoi
.
iYs
,
tpRoi
.
iWidth
,
tpRoi
.
iHeight
)).
clone
();
//image size
int
X
=
src
.
cols
,
Y
=
src
.
rows
;
...
...
@@ -602,6 +599,8 @@ int eyemCountObject(EyemImage tpImage, const char *fileName, double dOffset, int
src
/=
(
max
-
min
);
src
*=
65535
;
src
.
convertTo
(
src
,
CV_16UC1
);
cv
::
Mat
src8U
;
src
.
convertTo
(
src8U
,
CV_8UC1
,
1
/
255.
);
//for show
cv
::
Mat
cc
;
...
...
@@ -1539,7 +1538,7 @@ int eyemCountObject(EyemImage tpImage, const char *fileName, double dOffset, int
return
FUNC_OK
;
}
int
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
const
char
*
fileName
,
double
dOffset
,
const
char
*
ccSubType
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
)
int
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
double
dOffset
,
const
char
*
ccSubType
,
int
iMaxArea
,
int
iWinSize
,
LPSTR
*
lpszNumObj
,
EyemImage
*
tpDstImg
)
{
cv
::
Mat
src
=
cv
::
Mat
(
tpImage
.
iHeight
,
tpImage
.
iWidth
,
MAKETYPE
(
tpImage
.
iDepth
,
tpImage
.
iChannels
),
tpImage
.
vpImage
);
if
(
src
.
empty
())
{
...
...
@@ -1549,10 +1548,8 @@ int eyemCountObjectIrregularParts(EyemImage tpImage, const char *fileName, doubl
if
(
src
.
channels
()
!=
1
)
cv
::
cvtColor
(
src
,
src
,
cv
::
COLOR_BGR2GRAY
);
//环鸿&佳世达
src
=
src
(
cv
::
Range
(
200
,
src
.
cols
-
70
),
cv
::
Range
(
200
,
src
.
rows
-
10
)).
clone
();
//其他设备
//src = src(cv::Range(20, src.cols - 20), cv::Range(20, src.rows - 20)).clone();
//图像裁剪
src
=
src
(
cv
::
Rect
(
tpRoi
.
iXs
,
tpRoi
.
iYs
,
tpRoi
.
iWidth
,
tpRoi
.
iHeight
)).
clone
();
//图像尺寸
int
X
=
src
.
cols
,
Y
=
src
.
rows
;
...
...
@@ -4536,7 +4533,7 @@ int eyemCountObjectIrregularPartsE(EyemImage tpImage, EyemRect tpRoi, const char
if
(
trayEnd
)
{
//不再判断,大概率已经终止
found
=
false
;
}
}
else
if
(
trackMat
.
ptr
<
uint8_t
>
(
cvRound
(
trackCenterT
.
y
))[
cvRound
(
trackCenterT
.
x
)]
==
255
)
{
//不再判断,大概率已经终止
found
=
false
;
...
...
@@ -4587,8 +4584,8 @@ int eyemCountObjectIrregularPartsE(EyemImage tpImage, EyemRect tpRoi, const char
//std::cout << "总体耗时:" << 1000 * (static_cast<double>(cv::getTickCount()) - begin0) / cv::getTickFrequency() << std::endl;
trackEnd
=
(
!
found
);
}
while
(
!
trackEnd
);
}
}
while
(
!
trackEnd
);
}
//#pragma omp section //(逆时针)
{
...
...
@@ -4694,7 +4691,7 @@ int eyemCountObjectIrregularPartsE(EyemImage tpImage, EyemRect tpRoi, const char
{
//不再判断,大概率已经终止
found
=
false
;
}
}
else
if
(
trackMat
.
ptr
<
uint8_t
>
(
cvRound
(
trackCenterT
.
y
))[
cvRound
(
trackCenterT
.
x
)]
==
255
)
{
//不再判断,大概率已经终止
found
=
false
;
...
...
@@ -4743,9 +4740,9 @@ int eyemCountObjectIrregularPartsE(EyemImage tpImage, EyemRect tpRoi, const char
}
trackEnd
=
(
!
found
);
}
while
(
!
trackEnd
);
}
}
}
while
(
!
trackEnd
);
}
}
}
//计数
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论