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
7bcc5da8
Commit
7bcc5da8
authored
Jan 07, 2025
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化相机,颜色,接口检验
parent
27ffe3f4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
91 additions
and
20 deletions
+91
-20
AlgorithmTaskManage.cpp
+2
-2
AlgorithmTaskManage.h
+1
-1
CameraHandle.cpp
+10
-1
HttpService.cpp
+38
-2
HttpService.h
+8
-1
HumanDetection.cpp
+22
-7
HumanDetection.h
+2
-2
VidesData.h
+4
-2
mainwindow.cpp
+4
-2
No files found.
AlgorithmTaskManage.cpp
View file @
7bcc5da8
...
@@ -42,7 +42,7 @@ void AlgorithmTaskManage::initialize(int humanDetectionLen, int licensePlateLen,
...
@@ -42,7 +42,7 @@ void AlgorithmTaskManage::initialize(int humanDetectionLen, int licensePlateLen,
}
}
void
AlgorithmTaskManage
::
initHumanDetectionManage
(
const
QString
&
modelPaths
,
void
AlgorithmTaskManage
::
initHumanDetectionManage
(
const
QString
&
modelPaths
,
float
carShapeConfidence
,
int
&
uniformColor
)
{
float
carShapeConfidence
,
QString
&
uniformColor
)
{
for
(
int
i
=
0
;
i
<
humanDetectionLen
;
++
i
)
{
for
(
int
i
=
0
;
i
<
humanDetectionLen
;
++
i
)
{
HumanDetection
*
human
=
new
HumanDetection
(
modelPaths
,
carShapeConfidence
);
HumanDetection
*
human
=
new
HumanDetection
(
modelPaths
,
carShapeConfidence
);
human
->
setHuManParameter
(
uniformColor
);
human
->
setHuManParameter
(
uniformColor
);
...
@@ -113,7 +113,7 @@ void AlgorithmTaskManage::releaseResources(const vides_data::DetectionParams& pa
...
@@ -113,7 +113,7 @@ void AlgorithmTaskManage::releaseResources(const vides_data::DetectionParams& pa
QString
modelPath
=
params
.
modelPaths
;
QString
modelPath
=
params
.
modelPaths
;
float
humanCarShapeConfidence
=
params
.
humanCarShapeConfidence
;
float
humanCarShapeConfidence
=
params
.
humanCarShapeConfidence
;
int
uniformColor
=
params
.
uniformColor
;
QString
uniformColor
=
params
.
uniformColor
;
std
::
map
<
QString
,
QString
>
faceMaps
=
params
.
faceMaps
;
std
::
map
<
QString
,
QString
>
faceMaps
=
params
.
faceMaps
;
int
numberFaces
=
params
.
numberFaces
;
int
numberFaces
=
params
.
numberFaces
;
float
faceConfidence
=
params
.
faceConfidence
;
float
faceConfidence
=
params
.
faceConfidence
;
...
...
AlgorithmTaskManage.h
View file @
7bcc5da8
...
@@ -26,7 +26,7 @@ public:
...
@@ -26,7 +26,7 @@ public:
void
initialize
(
int
humanDetectionLen
,
int
licensePlateLen
,
int
faceLen
,
bool
first
,
__uint8_t
algorithmPermissions
);
void
initialize
(
int
humanDetectionLen
,
int
licensePlateLen
,
int
faceLen
,
bool
first
,
__uint8_t
algorithmPermissions
);
void
initHumanDetectionManage
(
const
QString
&
modelPaths
,
void
initHumanDetectionManage
(
const
QString
&
modelPaths
,
float
carShapeConfidence
,
int
&
uniformColor
);
float
carShapeConfidence
,
QString
&
uniformColor
);
void
initLicensePlateManage
(
const
QString
&
modelPaths
,
bool
is_high
,
int
maxNum
,
bool
useHalf
,
void
initLicensePlateManage
(
const
QString
&
modelPaths
,
bool
is_high
,
int
maxNum
,
bool
useHalf
,
float
boxThreshold
,
float
nmsThreshold
,
float
recThreshold
);
float
boxThreshold
,
float
nmsThreshold
,
float
recThreshold
);
...
...
CameraHandle.cpp
View file @
7bcc5da8
...
@@ -394,6 +394,10 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
...
@@ -394,6 +394,10 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
{
{
qInfo
()
<<
"OnDevAlarmCallback[Dev:"
<<
hObject
<<
"][Event:"
<<
szString
<<
"]"
;
qInfo
()
<<
"OnDevAlarmCallback[Dev:"
<<
hObject
<<
"][Event:"
<<
szString
<<
"]"
;
}
}
if
(
algorithmPermissions
==
0x00
){
return
-
1
;
}
cv
::
Mat
image
;
cv
::
Mat
image
;
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
qint64
currentTime
=
QDateTime
::
currentSecsSinceEpoch
();
qint64
currentTime
=
QDateTime
::
currentSecsSinceEpoch
();
...
@@ -426,6 +430,11 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
...
@@ -426,6 +430,11 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
semaphore
.
release
();
// 释放信号量
semaphore
.
release
();
// 释放信号量
});
});
Common
&
instace
=
Common
::
getInstance
();
Common
&
instace
=
Common
::
getInstance
();
if
(
algorithmPermissions
==
0x00
){
return
;
}
cv
::
Mat
image
;
cv
::
Mat
image
;
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
qint64
currentTime
=
QDateTime
::
currentSecsSinceEpoch
();
qint64
currentTime
=
QDateTime
::
currentSecsSinceEpoch
();
...
@@ -511,7 +520,7 @@ void CameraHandle::checkAndUpdateCurrentPlate(ParkingSpaceInfo*park,const cv::Ma
...
@@ -511,7 +520,7 @@ void CameraHandle::checkAndUpdateCurrentPlate(ParkingSpaceInfo*park,const cv::Ma
}
else
{
}
else
{
// 没有车辆或车辆在停车区域内部,移除队列
// 没有车辆或车辆在停车区域内部,移除队列
park
->
removeNoQueue
();
park
->
removeNoQueue
();
q
Debug
()
<<
QString
(
"SN(%1): no出场::%2"
).
arg
(
sSn
).
arg
(
car_size
);
q
Info
()
<<
QString
(
"SN(%1): no出场::%2"
).
arg
(
sSn
).
arg
(
car_size
);
}
}
}
else
{
}
else
{
//当前不为空,新车,新车入场,老车出场
//当前不为空,新车,新车入场,老车出场
...
...
HttpService.cpp
View file @
7bcc5da8
#include "HttpService.h"
#include "HttpService.h"
vides_data
::
responseStsCredentials
HttpService
::
stsCredentials
;
vides_data
::
responseStsCredentials
HttpService
::
stsCredentials
;
QString
HttpService
::
sing_key
;
HttpService
::
HttpService
()
{
HttpService
::
HttpService
()
{
...
@@ -45,6 +46,7 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic
...
@@ -45,6 +46,7 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
QNetworkRequest
request
;
QNetworkRequest
request
;
assembleSingHeaders
(
request
);
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -78,6 +80,7 @@ vides_data::response* HttpService::httpPostRecord(int id,int recongnition_type,Q
...
@@ -78,6 +80,7 @@ vides_data::response* HttpService::httpPostRecord(int id,int recongnition_type,Q
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
QNetworkRequest
request
;
QNetworkRequest
request
;
assembleSingHeaders
(
request
);
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -99,6 +102,15 @@ vides_data::response* HttpService::httpPostRecord(int id,int recongnition_type,Q
...
@@ -99,6 +102,15 @@ vides_data::response* HttpService::httpPostRecord(int id,int recongnition_type,Q
void
HttpService
::
setHttpUrl
(
const
QString
&
httpUrl
){
void
HttpService
::
setHttpUrl
(
const
QString
&
httpUrl
){
this
->
httpUrl
=
httpUrl
;
this
->
httpUrl
=
httpUrl
;
}
}
void
HttpService
::
setSingKey
(
const
QString
&
key
)
{
sing_key
=
key
;
}
QString
HttpService
::
getSingKey
()
{
return
sing_key
;
}
vides_data
::
response
*
HttpService
::
httpFindCameras
(
QString
&
serialNumber
,
vides_data
::
responseDeviceData
&
responseData
)
{
vides_data
::
response
*
HttpService
::
httpFindCameras
(
QString
&
serialNumber
,
vides_data
::
responseDeviceData
&
responseData
)
{
httpUrl
.
append
(
"/api/v1.0/device/all"
);
httpUrl
.
append
(
"/api/v1.0/device/all"
);
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
...
@@ -106,6 +118,7 @@ vides_data::response *HttpService::httpFindCameras(QString &serialNumber,vides_d
...
@@ -106,6 +118,7 @@ vides_data::response *HttpService::httpFindCameras(QString &serialNumber,vides_d
query
.
addQueryItem
(
"sn"
,
serialNumber
);
query
.
addQueryItem
(
"sn"
,
serialNumber
);
query
.
addQueryItem
(
"new_token"
,
QString
::
number
(
1
));
query
.
addQueryItem
(
"new_token"
,
QString
::
number
(
1
));
QNetworkRequest
request
;
QNetworkRequest
request
;
assembleSingHeaders
(
request
);
QUrl
url
(
httpUrl
);
QUrl
url
(
httpUrl
);
url
.
setQuery
(
query
);
url
.
setQuery
(
query
);
request
.
setUrl
(
url
);
request
.
setUrl
(
url
);
...
@@ -222,6 +235,7 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque
...
@@ -222,6 +235,7 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque
QByteArray
bytearr
=
doc
.
toJson
(
QJsonDocument
::
Compact
);
QByteArray
bytearr
=
doc
.
toJson
(
QJsonDocument
::
Compact
);
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
assembleSingHeaders
(
request
);
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -264,6 +278,7 @@ vides_data::response* HttpService::httpFindFaceReconition(QString &serialNumber,
...
@@ -264,6 +278,7 @@ vides_data::response* HttpService::httpFindFaceReconition(QString &serialNumber,
query
.
addQueryItem
(
"sn"
,
serialNumber
);
query
.
addQueryItem
(
"sn"
,
serialNumber
);
QUrl
url
(
httpUrl
);
QUrl
url
(
httpUrl
);
url
.
setQuery
(
query
);
url
.
setQuery
(
query
);
assembleSingHeaders
(
request
);
request
.
setUrl
(
url
);
request
.
setUrl
(
url
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -305,6 +320,7 @@ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,QString &id,
...
@@ -305,6 +320,7 @@ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,QString &id,
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
QNetworkRequest
request
;
QNetworkRequest
request
;
assembleSingHeaders
(
request
);
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -346,6 +362,7 @@ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &h
...
@@ -346,6 +362,7 @@ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &h
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
QNetworkRequest
request
;
QNetworkRequest
request
;
assembleSingHeaders
(
request
);
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -394,6 +411,7 @@ vides_data::response *HttpService::httpPostFaceReconition(vides_data::requestFac
...
@@ -394,6 +411,7 @@ vides_data::response *HttpService::httpPostFaceReconition(vides_data::requestFac
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
vides_data
::
response
*
resp
=
new
vides_data
::
response
();
QNetworkRequest
request
;
QNetworkRequest
request
;
assembleSingHeaders
(
request
);
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setUrl
(
QUrl
(
httpUrl
));
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
...
@@ -419,6 +437,7 @@ vides_data::response*HttpService::httpFindGb28181Config(QString &serialNumber){
...
@@ -419,6 +437,7 @@ vides_data::response*HttpService::httpFindGb28181Config(QString &serialNumber){
QNetworkRequest
request
;
QNetworkRequest
request
;
QUrl
url
(
httpUrl
);
QUrl
url
(
httpUrl
);
url
.
setQuery
(
query
);
url
.
setQuery
(
query
);
assembleSingHeaders
(
request
);
request
.
setUrl
(
url
);
request
.
setUrl
(
url
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -462,6 +481,7 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
...
@@ -462,6 +481,7 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
QNetworkRequest
request
;
QNetworkRequest
request
;
QUrl
url
(
httpUrl
);
QUrl
url
(
httpUrl
);
url
.
setQuery
(
query
);
url
.
setQuery
(
query
);
assembleSingHeaders
(
request
);
request
.
setUrl
(
url
);
request
.
setUrl
(
url
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
request
.
setRawHeader
(
vides_data
::
HEADER_TYPE_KAY
,
vides_data
::
HEADER_TYPE_VALUE
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
QMutexLocker
locker
(
&
m_httpClientMutex
);
...
@@ -533,7 +553,7 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
...
@@ -533,7 +553,7 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
// 解析 uniformConfig
// 解析 uniformConfig
QJsonObject
uniformConfigObj
=
dataObj
[
"uniformConfig"
].
toObject
();
QJsonObject
uniformConfigObj
=
dataObj
[
"uniformConfig"
].
toObject
();
config
.
uniformConfig
.
isOn
=
uniformConfigObj
[
"isOn"
].
toBool
();
config
.
uniformConfig
.
isOn
=
uniformConfigObj
[
"isOn"
].
toBool
();
config
.
uniformConfig
.
uniformColor
=
uniformConfigObj
[
"uniformColor"
].
to
Int
();
config
.
uniformConfig
.
uniformColor
=
uniformConfigObj
[
"uniformColor"
].
to
String
();
config
.
uniformConfig
.
humanDetectionLen
=
uniformConfigObj
[
"humanDetectionLen"
].
toInt
();
config
.
uniformConfig
.
humanDetectionLen
=
uniformConfigObj
[
"humanDetectionLen"
].
toInt
();
config
.
uniformConfig
.
updateAt
=
uniformConfigObj
[
"updateAt"
].
toVariant
().
toULongLong
();
config
.
uniformConfig
.
updateAt
=
uniformConfigObj
[
"updateAt"
].
toVariant
().
toULongLong
();
config
.
uniformConfig
.
carShapeConfidence
=
uniformConfigObj
[
"carShapeConfidence"
].
toVariant
().
toFloat
();
config
.
uniformConfig
.
carShapeConfidence
=
uniformConfigObj
[
"carShapeConfidence"
].
toVariant
().
toFloat
();
...
@@ -542,7 +562,6 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
...
@@ -542,7 +562,6 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
config
.
humanConfig
.
isOn
=
humanConfigObj
[
"isOn"
].
toBool
();
config
.
humanConfig
.
isOn
=
humanConfigObj
[
"isOn"
].
toBool
();
config
.
humanConfig
.
updateAt
=
humanConfigObj
[
"updateAt"
].
toVariant
().
toULongLong
();
config
.
humanConfig
.
updateAt
=
humanConfigObj
[
"updateAt"
].
toVariant
().
toULongLong
();
config
.
humanConfig
.
faceFrequency
=
humanConfigObj
[
"faceFrequency"
].
toVariant
().
toUInt
();
config
.
humanConfig
.
faceFrequency
=
humanConfigObj
[
"faceFrequency"
].
toVariant
().
toUInt
();
// 解析 devicesConfig
// 解析 devicesConfig
QJsonObject
devicesConfigObj
=
dataObj
[
"camera"
].
toObject
();
QJsonObject
devicesConfigObj
=
dataObj
[
"camera"
].
toObject
();
config
.
camera
.
password
=
devicesConfigObj
[
"password"
].
toString
();
config
.
camera
.
password
=
devicesConfigObj
[
"password"
].
toString
();
...
@@ -575,6 +594,23 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
...
@@ -575,6 +594,23 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
}
}
void
HttpService
::
assembleSingHeaders
(
QNetworkRequest
&
reques
){
QString
ts
=
QString
::
number
(
QDateTime
::
currentMSecsSinceEpoch
()
/
1000
);
// 计算签名
QCryptographicHash
hash
(
QCryptographicHash
::
Md5
);
hash
.
addData
(
HttpService
::
getSingKey
().
toUtf8
());
hash
.
addData
(
ts
.
toUtf8
());
QString
sign
=
hash
.
result
().
toHex
();
// 设置头部信息
QMap
<
QString
,
QVariant
>
headers
;
headers
.
insert
(
"ts"
,
ts
);
headers
.
insert
(
"sign"
,
sign
);
for
(
auto
it
=
headers
.
begin
();
it
!=
headers
.
end
();
++
it
)
{
reques
.
setRawHeader
(
it
.
key
().
toLatin1
(),
it
.
value
().
toString
().
toLatin1
());
}
}
vides_data
::
response
*
HttpService
::
httpFindStream
(
QString
&
serialNumber
){
vides_data
::
response
*
HttpService
::
httpFindStream
(
QString
&
serialNumber
){
httpUrl
.
append
(
"/api/v1.0/stream"
);
httpUrl
.
append
(
"/api/v1.0/stream"
);
...
...
HttpService.h
View file @
7bcc5da8
...
@@ -49,7 +49,13 @@ public:
...
@@ -49,7 +49,13 @@ public:
vides_data
::
response
*
httpUploadFile
(
const
QString
&
filePath
,
QString
&
accessKeyId
,
QString
&
accessKeySecret
,
vides_data
::
response
*
httpUploadFile
(
const
QString
&
filePath
,
QString
&
accessKeyId
,
QString
&
accessKeySecret
,
QString
&
bucketName
,
QString
&
securityToken
);
QString
&
bucketName
,
QString
&
securityToken
);
void
setHttpUrl
(
const
QString
&
httpUrl
);
void
setHttpUrl
(
const
QString
&
httpUrl
);
static
void
setSingKey
(
const
QString
&
key
);
static
QString
getSingKey
();
//组装验证头
void
assembleSingHeaders
(
QNetworkRequest
&
reques
);
vides_data
::
response
*
httpDeviceConfig
(
const
QString
&
serialNumber
,
vides_data
::
responseConfig
&
config
);
vides_data
::
response
*
httpDeviceConfig
(
const
QString
&
serialNumber
,
vides_data
::
responseConfig
&
config
);
...
@@ -62,6 +68,7 @@ private:
...
@@ -62,6 +68,7 @@ private:
HttpClient
m_httpClient
;
HttpClient
m_httpClient
;
QMutex
m_httpClientMutex
;
QMutex
m_httpClientMutex
;
static
QString
sing_key
;
};
};
#endif // HTTPSERVICE_H
#endif // HTTPSERVICE_H
HumanDetection.cpp
View file @
7bcc5da8
...
@@ -72,7 +72,7 @@ void HumanDetection::draw_human_on_image(const cv::Mat& image, const TCV_ObjectL
...
@@ -72,7 +72,7 @@ void HumanDetection::draw_human_on_image(const cv::Mat& image, const TCV_ObjectL
}
}
}
}
void
HumanDetection
::
setHuManParameter
(
int
&
uniformColor
){
void
HumanDetection
::
setHuManParameter
(
QString
&
uniformColor
){
this
->
uniformColor
=
uniformColor
;
this
->
uniformColor
=
uniformColor
;
}
}
...
@@ -98,23 +98,38 @@ int HumanDetection::findHuManCar(const cv::Mat &source, int res,std::map<int,int
...
@@ -98,23 +98,38 @@ int HumanDetection::findHuManCar(const cv::Mat &source, int res,std::map<int,int
int
num
=
0
;
int
num
=
0
;
if
(
res
==
0x00
||
res
==
0x02
)
{
if
(
res
==
0x00
||
res
==
0x02
)
{
QStringList
colorList
=
uniformColor
.
split
(
','
);
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
);
if
(
res
==
0x02
&&
colorList
.
size
()
==
0
){
TCV_HumanDetectorGetHumanLocation
(
detector
,
results
.
data
(),
num
);
reMap
[
0x02
]
=
0
;
// 未穿工服的行人数量
reMap
[
0x00
]
=
num
;
// 所有满足条件的行人数量
num
=
0
;
return
num
;
}
int
count_no_uniform
=
0
;
// 未穿工服的行人数量
int
count_no_uniform
=
0
;
// 未穿工服的行人数量
int
count_all
=
0
;
// 所有满足条件的行人数量
int
count_all
=
0
;
// 所有满足条件的行人数量
std
::
vector
<
TCV_ObjectLocation
>
results
(
num
);
TCV_HumanDetectorGetHumanLocation
(
detector
,
results
.
data
(),
num
);
QSet
<
int
>
uniformNumbers
;
for
(
const
QString
&
numStr
:
colorList
)
{
bool
ok
;
int
num
=
numStr
.
toInt
(
&
ok
);
if
(
ok
)
{
uniformNumbers
.
insert
(
num
);
}
}
for
(
const
auto
&
person
:
results
)
{
for
(
const
auto
&
person
:
results
)
{
int
tenPlace
=
uniformColor
/
10
;
// 十位
int
onePlace
=
uniformColor
%
10
;
// 个位
if
(
std
::
abs
(
person
.
y2
-
person
.
y1
)
>=
heightReference
)
{
if
(
std
::
abs
(
person
.
y2
-
person
.
y1
)
>=
heightReference
)
{
++
count_all
;
++
count_all
;
//工服
//工服
if
(
person
.
uniform
!=
tenPlace
&&
person
.
uniform
!=
onePlace
){
if
(
!
uniformNumbers
.
contains
(
person
.
uniform
)
){
vides_data
::
ParkingArea
area
;
vides_data
::
ParkingArea
area
;
area
.
topLeftCornerX
=
person
.
x1
;
area
.
topLeftCornerX
=
person
.
x1
;
area
.
topLeftCornerY
=
person
.
y1
;
area
.
topLeftCornerY
=
person
.
y1
;
...
...
HumanDetection.h
View file @
7bcc5da8
...
@@ -19,7 +19,7 @@ public:
...
@@ -19,7 +19,7 @@ public:
int
findHuManCar
(
const
cv
::
Mat
&
source
,
int
res
,
std
::
map
<
int
,
int
>&
reMap
,
QString
&
sSn
,
int
findHuManCar
(
const
cv
::
Mat
&
source
,
int
res
,
std
::
map
<
int
,
int
>&
reMap
,
QString
&
sSn
,
float
&
heightReference
,
std
::
vector
<
vides_data
::
ParkingArea
>
&
currentPlate
);
float
&
heightReference
,
std
::
vector
<
vides_data
::
ParkingArea
>
&
currentPlate
);
void
setHuManParameter
(
int
&
uniformColor
);
void
setHuManParameter
(
QString
&
uniformColor
);
void
draw_human_on_image
(
const
cv
::
Mat
&
image
,
const
TCV_ObjectLocation
*
boxes
,
int
size
);
void
draw_human_on_image
(
const
cv
::
Mat
&
image
,
const
TCV_ObjectLocation
*
boxes
,
int
size
);
...
@@ -27,7 +27,7 @@ private:
...
@@ -27,7 +27,7 @@ private:
//高度基准
//高度基准
float
heightReference
;
float
heightReference
;
int
uniformColor
;
QString
uniformColor
;
TCV_HumanDetector
*
detector
;
TCV_HumanDetector
*
detector
;
...
...
VidesData.h
View file @
7bcc5da8
...
@@ -289,7 +289,7 @@ struct LicensePlateConfig {
...
@@ -289,7 +289,7 @@ struct LicensePlateConfig {
struct
UniformConfig
{
struct
UniformConfig
{
bool
isOn
;
bool
isOn
;
int
uniformColor
;
QString
uniformColor
;
int
humanDetectionLen
;
int
humanDetectionLen
;
float
carShapeConfidence
;
float
carShapeConfidence
;
quint64
updateAt
;
quint64
updateAt
;
...
@@ -312,6 +312,8 @@ struct MqttConfig {
...
@@ -312,6 +312,8 @@ struct MqttConfig {
quint64
updateAt
;
quint64
updateAt
;
};
};
struct
responseConfig
{
struct
responseConfig
{
MainFormat
mainFormat
;
MainFormat
mainFormat
;
ExtraFormat
extraFormat
;
ExtraFormat
extraFormat
;
...
@@ -343,7 +345,7 @@ struct DetectionParams {
...
@@ -343,7 +345,7 @@ struct DetectionParams {
int
newFaceLen
;
int
newFaceLen
;
QString
modelPaths
;
QString
modelPaths
;
float
humanCarShapeConfidence
;
float
humanCarShapeConfidence
;
int
uniformColor
;
QString
uniformColor
;
std
::
map
<
QString
,
QString
>
faceMaps
;
std
::
map
<
QString
,
QString
>
faceMaps
;
int
numberFaces
;
int
numberFaces
;
float
faceConfidence
;
float
faceConfidence
;
...
...
mainwindow.cpp
View file @
7bcc5da8
...
@@ -59,7 +59,7 @@ MainWindow::MainWindow():isResetting(false)
...
@@ -59,7 +59,7 @@ MainWindow::MainWindow():isResetting(false)
initFaceFaceRecognition
();
initFaceFaceRecognition
();
int
uniformColor
=
config
.
uniformConfig
.
uniformColor
;
QString
uniformColor
=
config
.
uniformConfig
.
uniformColor
;
int
humanDetectionLen
=
config
.
uniformConfig
.
humanDetectionLen
;
int
humanDetectionLen
=
config
.
uniformConfig
.
humanDetectionLen
;
int
licensePlateLen
=
config
.
licensePlateConfig
.
licensePlateLen
;
int
licensePlateLen
=
config
.
licensePlateConfig
.
licensePlateLen
;
...
@@ -102,7 +102,9 @@ MainWindow::MainWindow():isResetting(false)
...
@@ -102,7 +102,9 @@ MainWindow::MainWindow():isResetting(false)
},
Qt
::
QueuedConnection
);
},
Qt
::
QueuedConnection
);
this
->
startCamera
(
httpurl
);
this
->
startCamera
(
httpurl
);
QString
sign_Key
=
qSetting
->
value
(
"cloudservice/signKey"
,
"sign_key"
).
toString
();
HttpService
::
setSingKey
(
sign_Key
);
float
confidence
=
config
.
faceConfig
.
confidence
;
float
confidence
=
config
.
faceConfig
.
confidence
;
int
faceNumbers
=
config
.
faceConfig
.
faceNumbers
;
int
faceNumbers
=
config
.
faceConfig
.
faceNumbers
;
...
...
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