Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gamera_videos_no_ui
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liusq
gamera_videos_no_ui
Commits
4685a514
Commit
4685a514
authored
Sep 14, 2024
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改人体为人形
parent
1542f525
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
HumanDetection.cpp
+1
-1
MediaFaceImage.cpp
+14
-14
No files found.
HumanDetection.cpp
View file @
4685a514
...
@@ -100,7 +100,7 @@ int HumanDetection::findHuManCar(const cv::Mat &source, int res,std::map<int,int
...
@@ -100,7 +100,7 @@ int HumanDetection::findHuManCar(const cv::Mat &source, int res,std::map<int,int
if
(
res
==
0x00
||
res
==
0x02
)
{
if
(
res
==
0x00
||
res
==
0x02
)
{
num
=
TCV_HumanDetectorGetNumOfHuman
(
detector
);
num
=
TCV_HumanDetectorGetNumOfHuman
(
detector
);
qInfo
()
<<
QString
(
"SN(%1): 获取人
体
数量:%2"
).
arg
(
sSn
).
arg
(
num
);
qInfo
()
<<
QString
(
"SN(%1): 获取人
形
数量:%2"
).
arg
(
sSn
).
arg
(
num
);
if
(
num
==
0
)
return
num
;
// 无行人检测结果,提前返回
if
(
num
==
0
)
return
num
;
// 无行人检测结果,提前返回
std
::
vector
<
TCV_ObjectLocation
>
results
(
num
);
std
::
vector
<
TCV_ObjectLocation
>
results
(
num
);
TCV_HumanDetectorGetHumanLocation
(
detector
,
results
.
data
(),
num
);
TCV_HumanDetectorGetHumanLocation
(
detector
,
results
.
data
(),
num
);
...
...
MediaFaceImage.cpp
View file @
4685a514
...
@@ -62,7 +62,7 @@ static int sdkInitCallback(XSDK_HANDLE hObject, int nMsgId, int nParam1,
...
@@ -62,7 +62,7 @@ static int sdkInitCallback(XSDK_HANDLE hObject, int nMsgId, int nParam1,
auto
taskCallBack
=
std
::
bind
(
&
CameraHandle
::
callbackFunction
,
cameraHandle
,
hObject
,
qString
);
auto
taskCallBack
=
std
::
bind
(
&
CameraHandle
::
callbackFunction
,
cameraHandle
,
hObject
,
qString
);
auto
taskRunnable
=
new
TaskRunnable
(
taskCallBack
,
hObject
,
cameraHandle
->
getChannel
(),
RunFunction
::
SdkCallbackFunction
);
auto
taskRunnable
=
new
TaskRunnable
(
taskCallBack
,
hObject
,
cameraHandle
->
getChannel
(),
RunFunction
::
SdkCallbackFunction
);
threadPool
->
start
(
taskRunnable
);
threadPool
->
start
(
taskRunnable
);
}
}
}
}
break
;
break
;
...
@@ -92,8 +92,8 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic
...
@@ -92,8 +92,8 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic
for
(
int
i
=
0
;
i
<
nActualCount
;
i
++
)
for
(
int
i
=
0
;
i
<
nActualCount
;
i
++
)
{
{
qInfo
()
<<
QString
(
"[%1][IP:%2.%3.%4.%5][SN:%6][Mac:%7]"
)
qInfo
()
<<
QString
(
"[%1][IP:%2.%3.%4.%5][SN:%6][Mac:%7]"
)
.
arg
(
i
)
.
arg
(
i
)
.
arg
(
pRet
[
i
].
HostIP
.
c
[
0
])
.
arg
(
pRet
[
i
].
HostIP
.
c
[
0
])
.
arg
(
pRet
[
i
].
HostIP
.
c
[
1
])
.
arg
(
pRet
[
i
].
HostIP
.
c
[
1
])
.
arg
(
pRet
[
i
].
HostIP
.
c
[
2
])
.
arg
(
pRet
[
i
].
HostIP
.
c
[
2
])
.
arg
(
pRet
[
i
].
HostIP
.
c
[
3
])
.
arg
(
pRet
[
i
].
HostIP
.
c
[
3
])
...
@@ -235,49 +235,49 @@ int MediaFaceImage::FaceImageCallBack(XSDK_HANDLE hMedia, int nChannel, cv::Mat
...
@@ -235,49 +235,49 @@ int MediaFaceImage::FaceImageCallBack(XSDK_HANDLE hMedia, int nChannel, cv::Mat
image
.
release
();
// 释放之前的图像
image
.
release
();
// 释放之前的图像
std
::
unique_ptr
<
unsigned
char
[]
>
pOutBuffer
(
new
unsigned
char
[
BufferSize
]);
// 智能指针管理内存
std
::
unique_ptr
<
unsigned
char
[]
>
pOutBuffer
(
new
unsigned
char
[
BufferSize
]);
// 智能指针管理内存
int
pInOutBufferSize
=
0
;
int
pInOutBufferSize
=
0
;
int
ret
=
XSDK_DevSnapSyn
(
hMedia
,
nChannel
,
""
,
pOutBuffer
.
get
(),
&
pInOutBufferSize
);
int
ret
=
XSDK_DevSnapSyn
(
hMedia
,
nChannel
,
""
,
pOutBuffer
.
get
(),
&
pInOutBufferSize
);
if
(
ret
<
0
||
pInOutBufferSize
<=
0
)
{
if
(
ret
<
0
||
pInOutBufferSize
<=
0
)
{
qInfo
()
<<
sSn
<<
":同步设备端抓图失败"
;
qInfo
()
<<
QString
(
"SN(%1): 同步设备端抓图失败"
).
arg
(
sSn
);
;
return
-
1
;
return
-
1
;
}
}
// 使用 std::vector 管理缓冲区数据
// 使用 std::vector 管理缓冲区数据
std
::
vector
<
uchar
>
buffer
(
pInOutBufferSize
);
std
::
vector
<
uchar
>
buffer
(
pInOutBufferSize
);
memcpy
(
buffer
.
data
(),
pOutBuffer
.
get
(),
pInOutBufferSize
);
memcpy
(
buffer
.
data
(),
pOutBuffer
.
get
(),
pInOutBufferSize
);
try
{
try
{
cv
::
Mat
decodedImage
=
cv
::
imdecode
(
buffer
,
cv
::
IMREAD_UNCHANGED
);
cv
::
Mat
decodedImage
=
cv
::
imdecode
(
buffer
,
cv
::
IMREAD_UNCHANGED
);
if
(
decodedImage
.
empty
())
{
if
(
decodedImage
.
empty
())
{
qInfo
()
<<
sSn
<<
":图像解码失败"
;
qInfo
()
<<
QString
(
"SN(%1): 图像解码失败"
).
arg
(
sSn
);
;
return
-
1
;
return
-
1
;
}
}
image
=
std
::
move
(
decodedImage
);
image
=
std
::
move
(
decodedImage
);
}
catch
(
const
cv
::
Exception
&
e
)
{
}
catch
(
const
cv
::
Exception
&
e
)
{
qInfo
()
<<
sSn
<<
":图像解码过程中捕获异常:"
<<
e
.
what
();
qInfo
()
<<
QString
(
"SN(%1): 图像解码过程中捕获异常:%2"
).
arg
(
sSn
).
arg
(
e
.
what
());
return
-
1
;
return
-
1
;
}
}
return
pInOutBufferSize
;
return
pInOutBufferSize
;
}
}
int
MediaFaceImage
::
CameraImage
(
XSDK_HANDLE
hMedia
,
int
nChannel
,
std
::
vector
<
uchar
>
&
buffer
){
int
MediaFaceImage
::
CameraImage
(
XSDK_HANDLE
hMedia
,
int
nChannel
,
std
::
vector
<
uchar
>
&
buffer
){
static
const
int
BufferSize
=
1024
*
1024
*
2
;
// 2MB buffer size
static
const
int
BufferSize
=
1024
*
1024
*
2
;
// 2MB buffer size
static
unsigned
char
pOutBuffer
[
BufferSize
];
static
unsigned
char
pOutBuffer
[
BufferSize
];
// 初始化为0,用于接收实际填充的大小
// 初始化为0,用于接收实际填充的大小
int
pInOutBufferSize
=
0
;
int
pInOutBufferSize
=
0
;
// 尝试从设备获取快照数据
// 尝试从设备获取快照数据
int
ret
=
XSDK_DevSnapSyn
(
hMedia
,
nChannel
,
""
,
pOutBuffer
,
&
pInOutBufferSize
);
int
ret
=
XSDK_DevSnapSyn
(
hMedia
,
nChannel
,
""
,
pOutBuffer
,
&
pInOutBufferSize
);
if
(
ret
<
0
||
pInOutBufferSize
<=
0
)
{
if
(
ret
<
0
||
pInOutBufferSize
<=
0
)
{
qInfo
()
<<
"同步设备端抓图失败"
;
qInfo
()
<<
"同步设备端抓图失败"
;
return
-
1
;
// 返回-1表示失败
return
-
1
;
// 返回-1表示失败
}
}
// 用pOutBuffer里的数据初始化vector,复制数据到vector中
// 用pOutBuffer里的数据初始化vector,复制数据到vector中
buffer
=
std
::
vector
<
uchar
>
(
pOutBuffer
,
pOutBuffer
+
pInOutBufferSize
);
buffer
=
std
::
vector
<
uchar
>
(
pOutBuffer
,
pOutBuffer
+
pInOutBufferSize
);
// 返回实际填入Vector的数据大小
// 返回实际填入Vector的数据大小
return
pInOutBufferSize
;
return
pInOutBufferSize
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment