Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张士柳
/
eyemLib
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit c7efc275
由
张士柳
编写于
2022-03-09 15:45:08 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
无
1 个父辈
79de92b9
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
96 行增加
和
15 行删除
eyemLib-Sharp/EyemLib.cs
eyemLib-Sharp/Properties/AssemblyInfo.cs
eyemLib-Sharp/UnmanagedBitmap.cs
eyemLib/eyemClp2d.cpp
eyemLib/eyemFit.cpp
eyemLib/eyemLib.cpp
eyemLib/eyemLib.h
eyemLib/eyemLib.rc
eyemLib/eyemMat.cpp
eyemLib/eyemMisc.cpp
eyemLib/eyemMisc.h
eyemLib/eyemSmooth.cpp
eyemLib-Sharp/EyemLib.cs
查看文件 @
c7efc27
此文件的差异被折叠,
点击展开。
eyemLib-Sharp/Properties/AssemblyInfo.cs
查看文件 @
c7efc27
...
@@ -6,11 +6,11 @@ using System.Runtime.InteropServices;
...
@@ -6,11 +6,11 @@ using System.Runtime.InteropServices;
// 控制。更改这些特性值可修改
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
// 与程序集关联的信息。
[assembly: AssemblyTitle("eyemLib-Sharp")]
[assembly: AssemblyTitle("eyemLib-Sharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("
eyemLib调试
")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("
上海挚锦科技有限公司
")]
[assembly: AssemblyProduct("eyemLib-Sharp")]
[assembly: AssemblyProduct("eyemLib-Sharp")]
[assembly: AssemblyCopyright("Copyright
© 2020
")]
[assembly: AssemblyCopyright("Copyright
2020 © NeoTel. All Rights Reserved
")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCulture("")]
...
...
eyemLib-Sharp/UnmanagedBitmap.cs
查看文件 @
c7efc27
...
@@ -61,7 +61,7 @@ namespace eyemLib_Sharp
...
@@ -61,7 +61,7 @@ namespace eyemLib_Sharp
{
{
// dispose managed resources
// dispose managed resources
}
}
//这里特别修改了eyemCvtToEyemImage的内存分配,因此皆可以由此接口释放
//这里特别修改了eyemCvtToEyemImage
中
的内存分配,因此皆可以由此接口释放
eyemImageFree
(
ref
image
);
eyemImageFree
(
ref
image
);
}
}
...
...
eyemLib/eyemClp2d.cpp
查看文件 @
c7efc27
...
@@ -228,4 +228,19 @@ int eyemClp2dTangentPointToCircle(EyemOcsDXY tpPoint, EyemOcsDXYR tpCircle, Eyem
...
@@ -228,4 +228,19 @@ int eyemClp2dTangentPointToCircle(EyemOcsDXY tpPoint, EyemOcsDXYR tpCircle, Eyem
tpTangent2
.
dA
=
-
(
tpPoint
.
dY
-
tpContact2
.
dY
);
tpTangent2
.
dB
=
(
tpPoint
.
dX
-
tpContact2
.
dX
);
tpTangent2
.
dC
=
tpContact2
.
dX
*
tpPoint
.
dY
-
tpTangent2
.
dA
=
-
(
tpPoint
.
dY
-
tpContact2
.
dY
);
tpTangent2
.
dB
=
(
tpPoint
.
dX
-
tpContact2
.
dX
);
tpTangent2
.
dC
=
tpContact2
.
dX
*
tpPoint
.
dY
-
tpPoint
.
dX
*
tpContact2
.
dY
;
tpPoint
.
dX
*
tpContact2
.
dY
;
return
FUNC_OK
;
return
FUNC_OK
;
}
int
eyemClp2dIntersectionLineAndConvexPolygon
()
{
return
FUNC_OK
;
}
int
eyemClp2dAreaOfPolygon
()
{
return
FUNC_OK
;
}
int
eyemClp2dPointInPolygon
()
{
return
FUNC_OK
;
}
}
\ No newline at end of file
\ No newline at end of file
eyemLib/eyemFit.cpp
查看文件 @
c7efc27
...
@@ -279,7 +279,6 @@ static void fitLine2D_wods(int iPtnNum, const EyemOcsDXY2D *taPoints, EyemOcsDAB
...
@@ -279,7 +279,6 @@ static void fitLine2D_wods(int iPtnNum, const EyemOcsDXY2D *taPoints, EyemOcsDAB
}
}
cv
::
Vec4f
linebuf
;
cv
::
Vec4f
linebuf
;
cv
::
fitLine
(
points
,
linebuf
,
cv
::
DIST_HUBER
,
.0
,
1e-2
,
1e-2
);
cv
::
fitLine
(
points
,
linebuf
,
cv
::
DIST_HUBER
,
.0
,
1e-2
,
1e-2
);
double
px
=
linebuf
[
2
],
py
=
linebuf
[
3
];
double
px
=
linebuf
[
2
],
py
=
linebuf
[
3
];
double
nx
=
linebuf
[
1
],
ny
=
-
linebuf
[
0
];
double
nx
=
linebuf
[
1
],
ny
=
-
linebuf
[
0
];
//直线一般式
//直线一般式
...
@@ -757,7 +756,7 @@ static void fitEllipse_wods(int iPtnNum, const EyemOcsDXY *taPoints, float *weig
...
@@ -757,7 +756,7 @@ static void fitEllipse_wods(int iPtnNum, const EyemOcsDXY *taPoints, float *weig
linebuf
[
0
]
=
rbox
.
center
.
x
;
linebuf
[
1
]
=
rbox
.
center
.
y
;
linebuf
[
2
]
=
cv
::
max
(
rbox
.
size
.
width
/
2.0
f
,
rbox
.
size
.
height
/
2.0
f
);
linebuf
[
3
]
=
cv
::
min
(
rbox
.
size
.
width
/
2.0
f
,
rbox
.
size
.
height
/
2.0
f
);
linebuf
[
4
]
=
rbox
.
angle
*
(
float
)
PI
/
180.0
f
;
linebuf
[
0
]
=
rbox
.
center
.
x
;
linebuf
[
1
]
=
rbox
.
center
.
y
;
linebuf
[
2
]
=
cv
::
max
(
rbox
.
size
.
width
/
2.0
f
,
rbox
.
size
.
height
/
2.0
f
);
linebuf
[
3
]
=
cv
::
min
(
rbox
.
size
.
width
/
2.0
f
,
rbox
.
size
.
height
/
2.0
f
);
linebuf
[
4
]
=
rbox
.
angle
*
(
float
)
PI
/
180.0
f
;
}
}
int
eyemRobustFitEllipse
(
int
iPtnNum
,
EyemOcsDXY
*
taPoint
,
int
iCalcMode
,
double
dRobustCoef
,
EyemOcsDXYLSQ
&
tpEllipse
)
int
eyemRobustFitEllipse
(
int
iPtnNum
,
EyemOcsDXY
*
taPoint
,
int
iCalcMode
,
double
dRobustCoef
,
EyemOcsDXYLSQ
&
tpEllipse
)
{
{
float
linebuf
[
5
]
=
{
.0
f
};
float
linebuf
[
5
]
=
{
.0
f
};
memset
(
linebuf
,
0
,
5
*
sizeof
(
float
));
memset
(
linebuf
,
0
,
5
*
sizeof
(
float
));
...
@@ -779,3 +778,12 @@ int eyemRobustFitEllipse(int iPtnNum, EyemOcsDXY * taPoint, int iCalcMode, doubl
...
@@ -779,3 +778,12 @@ int eyemRobustFitEllipse(int iPtnNum, EyemOcsDXY * taPoint, int iCalcMode, doubl
return
FUNC_OK
;
return
FUNC_OK
;
}
}
int
eyemRobustFitRectangle
(
int
iPtnNum
,
EyemOcsDXY
*
taPoint
,
int
iCalcMode
,
double
dRobustCoef
,
EyemRotateRect
&
tpRect
)
{
//先计算最小外包,然后计算各点到矩形的最小平方差和
//cv::minAreaRect();
return
FUNC_OK
;
}
eyemLib/eyemLib.cpp
查看文件 @
c7efc27
...
@@ -31,6 +31,12 @@ void setProcessLevel(double processLevel_)
...
@@ -31,6 +31,12 @@ void setProcessLevel(double processLevel_)
processLevel
=
processLevel_
;
processLevel
=
processLevel_
;
}
}
double
fineTuning
=
0.7
;
void
setFineTuning
(
double
fineTuning_
)
{
fineTuning
=
fineTuning_
;
}
std
::
map
<
std
::
string
,
EyemImage
>
imageMap
;
std
::
map
<
std
::
string
,
EyemImage
>
imageMap
;
void
loadImage2Mem
(
const
char
*
key
,
EyemImage
tpImage
)
void
loadImage2Mem
(
const
char
*
key
,
EyemImage
tpImage
)
{
{
...
...
eyemLib/eyemLib.h
查看文件 @
c7efc27
...
@@ -7,6 +7,18 @@
...
@@ -7,6 +7,18 @@
#include <opencv.hpp>
#include <opencv.hpp>
#ifndef FILEVERSION
#define FILEVERSION "2.4.8.2"
#endif
#ifndef COPYRIGHT
#define COPYRIGHT "Copyright (C) 2020-2022 NeoTel. All Rights Reserved"
#endif
#ifndef ORIGINALFILENAME
#define ORIGINALFILENAME "eyemLib.dll"
#endif
#ifndef EXPORTS
#ifndef EXPORTS
#define EXPORTS __declspec(dllexport)
#define EXPORTS __declspec(dllexport)
#endif
#endif
...
@@ -189,14 +201,6 @@ typedef struct {
...
@@ -189,14 +201,6 @@ typedef struct {
double
dVar
;
// 可能会使用的值
double
dVar
;
// 可能会使用的值
}
EyemRect3
;
}
EyemRect3
;
//// 旋转矩形定义
//typedef struct {
// double dWidth; // 旋转矩形宽度
// double dHeight; // 旋转矩形高度
// double dAngle; // 旋转矩形角度(-90==>90)
// EyemOcsDXY tC; // 旋转矩形中心
//} EyemRotateRect;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Orthogonal Coordinate System
// Orthogonal Coordinate System
...
@@ -371,6 +375,13 @@ typedef struct {
...
@@ -371,6 +375,13 @@ typedef struct {
}
EyemHSVModel
;
// 用于HSV颜色模型分割(H(0-180)、S(0-255)、V(0-255))
}
EyemHSVModel
;
// 用于HSV颜色模型分割(H(0-180)、S(0-255)、V(0-255))
typedef
struct
{
EyemOcsDXY
tC
;
// 旋转矩形中心
double
dWidth
;
// 旋转矩形宽度
double
dHeight
;
// 旋转矩形高度
double
dAngle
;
// 旋转矩形角度
}
EyemRotateRect
;
// 旋转矩形定义
/********************************************************************************************/
/********************************************************************************************/
/* 每个特定于源的标头 */
/* 每个特定于源的标头 */
/********************************************************************************************/
/********************************************************************************************/
...
@@ -916,6 +927,7 @@ extern "C" {
...
@@ -916,6 +927,7 @@ extern "C" {
EXPORTS
int
eyemCountObjectE
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
int
*
ipReelNum
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectE
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
int
*
ipReelNum
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
const
char
*
ccSubType
,
int
*
ipReelNum
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularParts
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
const
char
*
ccSubType
,
int
*
ipReelNum
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularPartsE
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
const
char
*
ccTplName
,
IntPtr
hModelID
,
int
*
ipReelNum
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularPartsE
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
const
char
*
fileName
,
const
char
*
ccTplName
,
IntPtr
hModelID
,
int
*
ipReelNum
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCountObjectIrregularPartsMultiopt
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
int
iOptions
[
4
],
int
*
ipReelNum
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemAchvMatchMat
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemAchvMatchMat
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemAchvTemplateImage
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemAchvTemplateImage
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemCreateTemplateModel
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
double
dMinScore
,
const
char
*
ccTplName
);
EXPORTS
int
eyemCreateTemplateModel
(
EyemImage
tpImage
,
EyemRect
tpRoi
,
double
dMinScore
,
const
char
*
ccTplName
);
...
@@ -935,6 +947,8 @@ extern "C" {
...
@@ -935,6 +947,8 @@ extern "C" {
EXPORTS
int
eyemDrawCircle
(
EyemImage
tpImage
,
EyemOcsDXYR
tpCircle
);
EXPORTS
int
eyemDrawCircle
(
EyemImage
tpImage
,
EyemOcsDXYR
tpCircle
);
EXPORTS
int
eyemDrawRectangle
(
EyemImage
tpImag
,
EyemRect
tpRect
);
EXPORTS
int
eyemDrawRectangle
(
EyemImage
tpImag
,
EyemRect
tpRect
);
EXPORTS
int
eyemTrainImageSampler
(
EyemImage
tpImage
,
int
iSize
,
const
char
*
ccClassName
,
const
char
*
ccToPath
,
EyemImage
*
tpMatchImg
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemTrainImageSampler
(
EyemImage
tpImage
,
int
iSize
,
const
char
*
ccClassName
,
const
char
*
ccToPath
,
EyemImage
*
tpMatchImg
,
EyemImage
*
tpDstImg
);
EXPORTS
int
eyemAffineTransform
(
EyemImage
tpImage
,
double
tAngle
,
EyemOcsDXY
tpCenter
,
EyemImage
*
tpDstImg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
@@ -946,6 +960,9 @@ extern "C" __declspec(dllexport) void setSkipProcessID(int pid);
...
@@ -946,6 +960,9 @@ extern "C" __declspec(dllexport) void setSkipProcessID(int pid);
// 设置全局参数
// 设置全局参数
extern
"C"
__declspec
(
dllexport
)
void
setProcessLevel
(
double
pl
);
extern
"C"
__declspec
(
dllexport
)
void
setProcessLevel
(
double
pl
);
// 设置A算法全局参数
extern
"C"
__declspec
(
dllexport
)
void
setFineTuning
(
double
ft
);
// 加载图像到内存
// 加载图像到内存
extern
"C"
__declspec
(
dllexport
)
void
loadImage2Mem
(
const
char
*
key
,
EyemImage
tpImage
);
extern
"C"
__declspec
(
dllexport
)
void
loadImage2Mem
(
const
char
*
key
,
EyemImage
tpImage
);
...
...
eyemLib/eyemLib.rc
查看文件 @
c7efc27
此文件类型无法预览
eyemLib/eyemMat.cpp
查看文件 @
c7efc27
...
@@ -703,4 +703,38 @@ int eyemWarpShiftSubpix(EyemImage tpImage, double dShiftX, double dShiftY, EyemI
...
@@ -703,4 +703,38 @@ int eyemWarpShiftSubpix(EyemImage tpImage, double dShiftX, double dShiftY, EyemI
cv
::
Mat
imageShift
;
cv
::
Mat
imageShift
;
cv
::
warpAffine
(
image
,
imageShift
,
matM
,
image
.
size
(),
iInterMethod
,
0
);
cv
::
warpAffine
(
image
,
imageShift
,
matM
,
image
.
size
(),
iInterMethod
,
0
);
return
FUNC_OK
;
return
FUNC_OK
;
}
bool
eyemCheckBinary
(
EyemImage
tpImage
)
{
CV_Assert
(
NULL
!=
tpImage
.
vpImage
);
cv
::
Mat
image
=
cv
::
Mat
(
tpImage
.
iHeight
,
tpImage
.
iWidth
,
MAKETYPE
(
tpImage
.
iDepth
,
tpImage
.
iChannels
),
tpImage
.
vpImage
).
clone
();
if
(
image
.
empty
())
return
false
;
int
X
=
image
.
cols
,
Y
=
image
.
rows
;
int
incn
=
image
.
channels
();
if
(
incn
!=
1
)
{
return
false
;
}
int
bs
=
16
,
b
=
(
X
*
incn
)
/
bs
,
stride
=
(
int
)
image
.
step
;
for
(
int
y
=
0
;
y
<
Y
;
y
++
)
{
unsigned
char
*
LinePS
=
image
.
data
+
y
*
stride
;
for
(
int
x
=
0
;
x
<
b
*
bs
;
x
+=
bs
)
{
__m128i
SrcV
=
_mm_loadu_si128
((
__m128i
*
)(
LinePS
+
x
));
__m128i
MaskW
=
_mm_cmpeq_epi8
(
SrcV
,
_mm_set1_epi8
(
255
));
__m128i
MaskB
=
_mm_cmpeq_epi8
(
SrcV
,
_mm_setzero_si128
());
__m128i
Mask
=
_mm_or_si128
(
MaskW
,
MaskB
);
if
(
_mm_movemask_epi8
(
Mask
)
!=
65535
)
{
return
false
;
}
}
for
(
int
x
=
b
*
bs
;
x
<
X
*
incn
;
x
++
)
{
if
((
LinePS
[
x
]
!=
255
)
&&
(
LinePS
[
x
]
!=
0
))
{
return
false
;
}
}
}
return
true
;
}
}
\ No newline at end of file
\ No newline at end of file
eyemLib/eyemMisc.cpp
查看文件 @
c7efc27
此文件的差异太大,无法显示。
eyemLib/eyemMisc.h
查看文件 @
c7efc27
...
@@ -14,6 +14,7 @@ constexpr double c = PI / 180.;
...
@@ -14,6 +14,7 @@ constexpr double c = PI / 180.;
extern
Logger
logger
;
extern
Logger
logger
;
extern
int
killProcessID
;
extern
int
killProcessID
;
extern
double
processLevel
;
extern
double
processLevel
;
extern
double
fineTuning
;
extern
std
::
map
<
std
::
string
,
EyemImage
>
imageMap
;
extern
std
::
map
<
std
::
string
,
EyemImage
>
imageMap
;
#endif
/* __EYEM_MISC_H */
#endif
/* __EYEM_MISC_H */
eyemLib/eyemSmooth.cpp
查看文件 @
c7efc27
...
@@ -380,7 +380,7 @@ int eyemNonLocalMeansFilter(EyemImage tpImage, int iCMPSize, int iSearchSize, do
...
@@ -380,7 +380,7 @@ int eyemNonLocalMeansFilter(EyemImage tpImage, int iCMPSize, int iSearchSize, do
return
FUNC_IMAGE_NOT_EXIST
;
return
FUNC_IMAGE_NOT_EXIST
;
}
}
cv
::
Mat
dest
;
cv
::
Mat
dest
;
nonLocalMeansFilter_SSE
(
image
,
dest
,
cv
::
Size
(
3
,
3
),
cv
::
Size
(
5
,
5
),
10
.0
,
-
1
,
0
);
nonLocalMeansFilter_SSE
(
image
,
dest
,
cv
::
Size
(
3
,
3
),
cv
::
Size
(
3
,
3
),
5
.0
,
-
1
,
0
);
return
FUNC_OK
;
return
FUNC_OK
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论