Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张士柳
/
eyemLib
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 8c1dfa89
由
张士柳
编写于
2021-02-19 17:29:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
备份恢复
1 个父辈
3f8a946f
全部展开
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
79 行增加
和
6 行删除
eyemLib/eyemBarCode.cpp
eyemLib/eyemGeneric.cpp
eyemLib/eyemBarCode.cpp
查看文件 @
8c1dfa8
此文件的差异被折叠,
点击展开。
eyemLib/eyemGeneric.cpp
查看文件 @
8c1dfa8
...
@@ -88,7 +88,7 @@ int eyemVideoCapture(const char *fileName, IntPtr *hObject, EyemImage **tpImages
...
@@ -88,7 +88,7 @@ int eyemVideoCapture(const char *fileName, IntPtr *hObject, EyemImage **tpImages
int
totalFrmNum
=
cap
.
get
(
cv
::
CAP_PROP_FRAME_COUNT
);
int
totalFrmNum
=
cap
.
get
(
cv
::
CAP_PROP_FRAME_COUNT
);
std
::
vector
<
cv
::
Mat
>
*
pFrames
=
new
std
::
vector
<
cv
::
Mat
>
();
std
::
vector
<
EyemImage
>
*
pFrames
=
new
std
::
vector
<
EyemImage
>
();
cv
::
Mat
nextImg
;
cv
::
Mat
nextImg
;
while
(
true
)
while
(
true
)
...
@@ -97,13 +97,79 @@ int eyemVideoCapture(const char *fileName, IntPtr *hObject, EyemImage **tpImages
...
@@ -97,13 +97,79 @@ int eyemVideoCapture(const char *fileName, IntPtr *hObject, EyemImage **tpImages
if
(
nextImg
.
empty
())
if
(
nextImg
.
empty
())
break
;
break
;
//图像信息
EyemImage
tpImage
;
tpImage
.
iWidth
=
nextImg
.
cols
;
tpImage
.
iHeight
=
nextImg
.
rows
;
tpImage
.
iDepth
=
nextImg
.
depth
();
tpImage
.
iChannels
=
nextImg
.
channels
();
//内存尺寸
int
_Size
=
tpImage
.
iWidth
*
tpImage
.
iHeight
*
tpImage
.
iChannels
;
pFrames
->
push_back
(
nextImg
);
//需要申请内存
switch
(
tpImage
.
iDepth
)
{
case
CV_8U
:
_Size
*=
sizeof
(
uint8_t
);
tpImage
.
vpImage
=
(
uint8_t
*
)
malloc
(
_Size
);
if
(
NULL
==
tpImage
.
vpImage
)
return
FUNC_NOT_ENOUGH_MEM
;
memset
(
tpImage
.
vpImage
,
0
,
_Size
);
break
;
case
CV_8S
:
_Size
*=
sizeof
(
int8_t
);
tpImage
.
vpImage
=
(
int8_t
*
)
malloc
(
_Size
);
if
(
NULL
==
tpImage
.
vpImage
)
return
FUNC_NOT_ENOUGH_MEM
;
memset
(
tpImage
.
vpImage
,
0
,
_Size
);
break
;
case
CV_16U
:
_Size
*=
sizeof
(
uint16_t
);
tpImage
.
vpImage
=
(
uint16_t
*
)
malloc
(
_Size
);
if
(
NULL
==
tpImage
.
vpImage
)
return
FUNC_NOT_ENOUGH_MEM
;
memset
(
tpImage
.
vpImage
,
0
,
_Size
);
break
;
case
CV_16S
:
_Size
*=
sizeof
(
int16_t
);
tpImage
.
vpImage
=
(
int16_t
*
)
malloc
(
_Size
);
if
(
NULL
==
tpImage
.
vpImage
)
return
FUNC_NOT_ENOUGH_MEM
;
memset
(
tpImage
.
vpImage
,
0
,
_Size
);
break
;
case
CV_32S
:
_Size
*=
sizeof
(
int32_t
);
tpImage
.
vpImage
=
(
int32_t
*
)
malloc
(
_Size
);
if
(
NULL
==
tpImage
.
vpImage
)
return
FUNC_NOT_ENOUGH_MEM
;
memset
(
tpImage
.
vpImage
,
0
,
_Size
);
break
;
case
CV_32F
:
_Size
*=
sizeof
(
float_t
);
tpImage
.
vpImage
=
(
float_t
*
)
malloc
(
_Size
);
if
(
NULL
==
tpImage
.
vpImage
)
return
FUNC_NOT_ENOUGH_MEM
;
memset
(
tpImage
.
vpImage
,
0
,
_Size
);
break
;
case
CV_64F
:
_Size
*=
sizeof
(
double_t
);
tpImage
.
vpImage
=
(
double_t
*
)
malloc
(
_Size
);
if
(
NULL
==
tpImage
.
vpImage
)
return
FUNC_NOT_ENOUGH_MEM
;
memset
(
tpImage
.
vpImage
,
0
,
_Size
);
break
;
default:
//no support format
return
FUNC_CANNOT_USE
;
}
//拷贝数据
memcpy
(
tpImage
.
vpImage
,
nextImg
.
data
,
_Size
);
//
pFrames
->
push_back
(
tpImage
);
}
}
//*tpImages = pFrames->data();
*
tpImages
=
pFrames
->
data
();
//*ipNum = static_cast<int>(pFrames->size());
*
ipNum
=
static_cast
<
int
>
(
pFrames
->
size
());
//*hObject = dynamic_cast<IntPtr>();
*
hObject
=
reinterpret_cast
<
IntPtr
>
(
pFrames
);
return
FUNC_OK
;
return
FUNC_OK
;
}
}
...
@@ -801,7 +867,14 @@ void eyemImageFree(EyemImage &tpImage)
...
@@ -801,7 +867,14 @@ void eyemImageFree(EyemImage &tpImage)
int
eyemVideoCaptureFree
(
IntPtr
hObject
)
int
eyemVideoCaptureFree
(
IntPtr
hObject
)
{
{
std
::
vector
<
cv
::
Mat
>
*
tpImages
=
reinterpret_cast
<
std
::
vector
<
cv
::
Mat
>*>
(
hObject
);
std
::
vector
<
EyemImage
>
*
tpImages
=
reinterpret_cast
<
std
::
vector
<
EyemImage
>*>
(
hObject
);
for
(
std
::
vector
<
EyemImage
>::
iterator
it
=
tpImages
->
begin
();
it
!=
tpImages
->
end
();
++
it
)
{
EyemImage
tpImage
=
(
*
it
);
tpImage
.
iWidth
=
tpImage
.
iHeight
=
tpImage
.
iDepth
=
tpImage
.
iChannels
=
0
;
free
(
tpImage
.
vpImage
),
tpImage
.
vpImage
=
NULL
;
}
delete
tpImages
;
delete
tpImages
;
tpImages
=
NULL
;
tpImages
=
NULL
;
return
true
;
return
true
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论