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
0
Merge Requests
0
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
e5fe3f20
Commit
e5fe3f20
authored
Aug 22, 2024
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改http超时时间或车牌配置盒子信息
parent
cf45df20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
123 additions
and
66 deletions
+123
-66
AlgorithmTaskManage.cpp
+26
-15
AlgorithmTaskManage.h
+3
-10
CameraHandle.cpp
+6
-11
CameraHandle.h
+1
-1
HttpService.cpp
+6
-3
Httpclient.cpp
+1
-1
LicensePlateRecognition.cpp
+7
-6
LicensePlateRecognition.h
+3
-1
MqttSubscriber.cpp
+4
-3
VidesData.h
+25
-3
cameravideo
+0
-0
gamera_videos.pro
+3
-0
mainwindow.cpp
+38
-12
moc_predefs.h
+0
-0
No files found.
AlgorithmTaskManage.cpp
View file @
e5fe3f20
...
@@ -49,10 +49,11 @@ void AlgorithmTaskManage::initHumanDetectionManage(const QString &modelPaths,
...
@@ -49,10 +49,11 @@ void AlgorithmTaskManage::initHumanDetectionManage(const QString &modelPaths,
humanDetections
.
emplace_back
(
human
);
humanDetections
.
emplace_back
(
human
);
}
}
}
}
void
AlgorithmTaskManage
::
initLicensePlateManage
(
const
QString
&
modelPaths
,
void
AlgorithmTaskManage
::
initLicensePlateManage
(
const
QString
&
modelPaths
,
bool
is_high
,
int
maxNum
,
bool
useHalf
,
float
carConfidence
,
bool
is_high
){
float
boxThreshold
,
float
nmsThreshold
,
float
recThreshold
){
for
(
int
i
=
0
;
i
<
licensePlateLen
;
++
i
)
{
for
(
int
i
=
0
;
i
<
licensePlateLen
;
++
i
)
{
LicensePlateRecognition
*
licensePlateRecognition
=
new
LicensePlateRecognition
(
modelPaths
,
carConfidence
,
is_high
);
LicensePlateRecognition
*
licensePlateRecognition
=
new
LicensePlateRecognition
(
modelPaths
,
is_high
,
maxNum
,
useHalf
,
boxThreshold
,
nmsThreshold
,
recThreshold
);
licensePlateRecognitions
.
emplace_back
(
licensePlateRecognition
);
licensePlateRecognitions
.
emplace_back
(
licensePlateRecognition
);
}
}
...
@@ -95,28 +96,38 @@ AlgorithmTaskManage::~AlgorithmTaskManage(){
...
@@ -95,28 +96,38 @@ AlgorithmTaskManage::~AlgorithmTaskManage(){
}
}
}
}
void
AlgorithmTaskManage
::
releaseResources
(
void
AlgorithmTaskManage
::
releaseResources
(
const
vides_data
::
DetectionParams
&
params
)
{
int
newHumanDetectionLen
,
int
newLicensePlateLen
,
int
newFaceLen
,
const
QString
&
odelPaths
,
float
humanCarShapeConfidence
,
int
uniformColor
,
float
licensePlateCarConfidence
,
std
::
map
<
QString
,
QString
>&
faceMaps
,
int
numberFaces
,
float
faceConfidence
,
__uint8_t
algorithmPermissions
,
bool
is_high
)
{
Common
&
instance
=
Common
::
getInstance
();
Common
&
instance
=
Common
::
getInstance
();
isShuttingDown
.
store
(
true
,
std
::
memory_order_release
);
isShuttingDown
.
store
(
true
,
std
::
memory_order_release
);
ScopeSemaphoreExit
guard
([
this
]()
{
ScopeSemaphoreExit
guard
([
this
]()
{
isShuttingDown
.
store
(
false
,
std
::
memory_order_release
);
isShuttingDown
.
store
(
false
,
std
::
memory_order_release
);
});
});
__uint8_t
algorithmPermissions
=
params
.
algorithmPermissions
;
qInfo
()
<<
"修改参数:releaseResources "
<<
algorithmPermissions
;
qInfo
()
<<
"修改参数:releaseResources "
<<
algorithmPermissions
;
int
newHumanDetectionLen
=
params
.
newHumanDetectionLen
;
int
newLicensePlateLen
=
params
.
newLicensePlateLen
;
int
newFaceLen
=
params
.
newFaceLen
;
QString
modelPath
=
params
.
modelPaths
;
float
humanCarShapeConfidence
=
params
.
humanCarShapeConfidence
;
int
uniformColor
=
params
.
uniformColor
;
std
::
map
<
QString
,
QString
>
faceMaps
=
params
.
faceMaps
;
int
numberFaces
=
params
.
numberFaces
;
float
faceConfidence
=
params
.
faceConfidence
;
bool
high
=
params
.
isHigh
;
int
maxNum
=
params
.
maxNum
;
bool
useHalf
=
params
.
useHalf
;
float
boxThreshold
=
params
.
boxConfThreshold
;
float
nmsThreshold
=
params
.
nmsThreshold
;
float
recThreshold
=
params
.
recConfidenceThreshold
;
// 穿工服算法参数更新
// 穿工服算法参数更新
if
((
algorithmPermissions
&
0x01
<<
2
)
!=
0
)
{
if
((
algorithmPermissions
&
0x01
<<
2
)
!=
0
)
{
resetSemaphoreAndClearObjects
(
instance
,
semaphore
,
humanDetections
,
humanDetectionLen
);
resetSemaphoreAndClearObjects
(
instance
,
semaphore
,
humanDetections
,
humanDetectionLen
);
initialize
(
newHumanDetectionLen
,
newLicensePlateLen
,
newFaceLen
,
false
,
0x00
);
initialize
(
newHumanDetectionLen
,
newLicensePlateLen
,
newFaceLen
,
false
,
0x00
);
initHumanDetectionManage
(
odelPaths
,
humanCarShapeConfidence
,
uniformColor
);
initHumanDetectionManage
(
modelPath
,
humanCarShapeConfidence
,
uniformColor
);
}
}
// 人脸算法参数更新
// 人脸算法参数更新
...
@@ -130,7 +141,7 @@ void AlgorithmTaskManage::releaseResources(
...
@@ -130,7 +141,7 @@ void AlgorithmTaskManage::releaseResources(
if
((
algorithmPermissions
&
0x01
)
!=
0
)
{
if
((
algorithmPermissions
&
0x01
)
!=
0
)
{
resetSemaphoreAndClearObjects
(
instance
,
plateSemaphore
,
licensePlateRecognitions
,
licensePlateLen
);
resetSemaphoreAndClearObjects
(
instance
,
plateSemaphore
,
licensePlateRecognitions
,
licensePlateLen
);
initialize
(
newHumanDetectionLen
,
newLicensePlateLen
,
newFaceLen
,
false
,
0x01
);
initialize
(
newHumanDetectionLen
,
newLicensePlateLen
,
newFaceLen
,
false
,
0x01
);
initLicensePlateManage
(
odelPaths
,
licensePlateCarConfidence
,
is_high
);
initLicensePlateManage
(
modelPath
,
high
,
maxNum
,
useHalf
,
boxThreshold
,
nmsThreshold
,
recThreshold
);
}
}
}
}
...
...
AlgorithmTaskManage.h
View file @
e5fe3f20
...
@@ -28,8 +28,8 @@ public:
...
@@ -28,8 +28,8 @@ public:
void
initHumanDetectionManage
(
const
QString
&
modelPaths
,
void
initHumanDetectionManage
(
const
QString
&
modelPaths
,
float
carShapeConfidence
,
int
&
uniformColor
);
float
carShapeConfidence
,
int
&
uniformColor
);
void
initLicensePlateManage
(
const
QString
&
modelPaths
,
void
initLicensePlateManage
(
const
QString
&
modelPaths
,
bool
is_high
,
int
maxNum
,
bool
useHalf
,
float
carConfidence
,
bool
is_high
);
float
boxThreshold
,
float
nmsThreshold
,
float
recThreshold
);
void
modifyImageFeature
(
std
::
map
<
QString
,
QString
>&
maps
,
int
numberFaces
,
float
confidence
,
bool
isNull
);
void
modifyImageFeature
(
std
::
map
<
QString
,
QString
>&
maps
,
int
numberFaces
,
float
confidence
,
bool
isNull
);
void
initFaceReconitionHandle
(
std
::
map
<
QString
,
QString
>&
maps
,
int
numberFaces
,
float
confidence
);
void
initFaceReconitionHandle
(
std
::
map
<
QString
,
QString
>&
maps
,
int
numberFaces
,
float
confidence
);
...
@@ -37,14 +37,7 @@ public:
...
@@ -37,14 +37,7 @@ public:
void
*
schedulingAlgorithm
(
int
scheType
);
void
*
schedulingAlgorithm
(
int
scheType
);
void
releaseResources
(
int
newHumanDetectionLen
,
int
newLicensePlateLen
,
int
newFaceLen
,
const
QString
&
odelPaths
,
void
releaseResources
(
const
vides_data
::
DetectionParams
&
params
);
float
humanCarShapeConfidence
,
int
uniformColor
,
float
licensePlateCarConfidence
,
std
::
map
<
QString
,
QString
>&
faceMaps
,
int
numberFaces
,
float
faceConfidence
,
__uint8_t
algorithmPermissions
,
bool
is_high
);
...
...
CameraHandle.cpp
View file @
e5fe3f20
...
@@ -252,7 +252,7 @@ void CameraHandle::cameraParameterUpdate(vides_data::responseConfig &cloudConfig
...
@@ -252,7 +252,7 @@ void CameraHandle::cameraParameterUpdate(vides_data::responseConfig &cloudConfig
forMat
=
true
;
forMat
=
true
;
}
}
if
(
forMat
){
if
(
forMat
){
deviceReboot
(
true
);
deviceReboot
(
);
}
}
if
(
devConfig
.
camera
.
updateAt
!=
cloudConfig
.
camera
.
updateAt
){
if
(
devConfig
.
camera
.
updateAt
!=
cloudConfig
.
camera
.
updateAt
){
if
(
devConfig
.
camera
.
username
!=
cloudConfig
.
camera
.
username
||
if
(
devConfig
.
camera
.
username
!=
cloudConfig
.
camera
.
username
||
...
@@ -367,7 +367,6 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
...
@@ -367,7 +367,6 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
}
}
int
CameraHandle
::
callbackFunction
(
XSDK_HANDLE
hObject
,
QString
&
szString
)
{
int
CameraHandle
::
callbackFunction
(
XSDK_HANDLE
hObject
,
QString
&
szString
)
{
if
(
!
semaphore
.
tryAcquire
())
{
if
(
!
semaphore
.
tryAcquire
())
{
qInfo
()
<<
sSn
<<
"sdkDevSnapSyn:正在执行线程"
;
qInfo
()
<<
sSn
<<
"sdkDevSnapSyn:正在执行线程"
;
return
-
1
;
return
-
1
;
...
@@ -438,9 +437,10 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
...
@@ -438,9 +437,10 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
bool
is_ping
=
vides_data
::
pingAddress
(
ip
);
bool
is_ping
=
vides_data
::
pingAddress
(
ip
);
if
(
!
is_ping
){
if
(
!
is_ping
){
deviceReboot
(
false
);
deviceReboot
();
}
else
{
}
else
{
deviceReboot
(
true
);
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
MainWindow
::
sp_this
->
clearOfflineCameraHandle
(
ip
,
loginParam
->
nDevPort
);
}
}
// 执行离线处理逻辑
// 执行离线处理逻辑
// TODO: 可以在此处更新设备状态、发送告警通知等
// TODO: 可以在此处更新设备状态、发送告警通知等
...
@@ -853,7 +853,6 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
...
@@ -853,7 +853,6 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
}
}
}
}
void
CameraHandle
::
findIp
(
QString
&
ip
){
void
CameraHandle
::
findIp
(
QString
&
ip
){
ip
=
QString
::
fromStdString
(
loginParam
->
sDevId
);
ip
=
QString
::
fromStdString
(
loginParam
->
sDevId
);
...
@@ -947,7 +946,7 @@ void CameraHandle::sdkWifi(QString &pwd,QString &ssid){
...
@@ -947,7 +946,7 @@ void CameraHandle::sdkWifi(QString &pwd,QString &ssid){
qInfo
()
<<
"修改wifi失败"
;
qInfo
()
<<
"修改wifi失败"
;
}
}
deviceReboot
(
false
);
deviceReboot
();
}
}
void
CameraHandle
::
sdkDevSystemTimeZoneSyn
(
QString
&
time
){
void
CameraHandle
::
sdkDevSystemTimeZoneSyn
(
QString
&
time
){
...
@@ -1073,7 +1072,7 @@ void CameraHandle::sdkDevSpvMn(const char *spvMn){
...
@@ -1073,7 +1072,7 @@ void CameraHandle::sdkDevSpvMn(const char *spvMn){
qInfo
()
<<
"sdkDevSpvMn 28181->修改失败"
<<
res
;
qInfo
()
<<
"sdkDevSpvMn 28181->修改失败"
<<
res
;
}
}
}
}
int
CameraHandle
::
deviceReboot
(
bool
isCloseHandle
){
int
CameraHandle
::
deviceReboot
(){
int
nRet
=
0
;
int
nRet
=
0
;
XSDK_CFG
::
OPMachine
cfg
;
XSDK_CFG
::
OPMachine
cfg
;
cfg
.
Action
.
SetValue
(
"Reboot"
);
cfg
.
Action
.
SetValue
(
"Reboot"
);
...
@@ -1084,10 +1083,6 @@ int CameraHandle::deviceReboot(bool isCloseHandle){
...
@@ -1084,10 +1083,6 @@ int CameraHandle::deviceReboot(bool isCloseHandle){
qInfo
()
<<
sSn
<<
"重启相机失败"
<<
nRet
;
qInfo
()
<<
sSn
<<
"重启相机失败"
<<
nRet
;
return
0
;
return
0
;
}
}
if
(
isCloseHandle
){
return
0
;
}
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
QString
ip
=
QString
::
fromUtf8
(
loginParam
->
sDevId
);
MainWindow
::
sp_this
->
clearOfflineCameraHandle
(
ip
,
loginParam
->
nDevPort
);
MainWindow
::
sp_this
->
clearOfflineCameraHandle
(
ip
,
loginParam
->
nDevPort
);
return
nRet
;
return
nRet
;
...
...
CameraHandle.h
View file @
e5fe3f20
...
@@ -100,7 +100,7 @@ public:
...
@@ -100,7 +100,7 @@ public:
void
updateSdkDevSpvMn
(
vides_data
::
responseGb28181
*
gb28181
);
void
updateSdkDevSpvMn
(
vides_data
::
responseGb28181
*
gb28181
);
//重启设备
//重启设备
int
deviceReboot
(
bool
isCloseHandle
);
int
deviceReboot
();
//设备关机
//设备关机
int
deviceShutdown
();
int
deviceShutdown
();
//获取固件版本
//获取固件版本
...
...
HttpService.cpp
View file @
e5fe3f20
...
@@ -518,13 +518,18 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
...
@@ -518,13 +518,18 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
// 解析 licensePlateConfig
// 解析 licensePlateConfig
QJsonObject
licensePlateConfigObj
=
dataObj
[
"licensePlateConfig"
].
toObject
();
QJsonObject
licensePlateConfigObj
=
dataObj
[
"licensePlateConfig"
].
toObject
();
config
.
licensePlateConfig
.
isOn
=
licensePlateConfigObj
[
"isOn"
].
toBool
();
config
.
licensePlateConfig
.
isOn
=
licensePlateConfigObj
[
"isOn"
].
toBool
();
config
.
licensePlateConfig
.
carConfidence
=
licensePlateConfigObj
[
"carConfidence
"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
recConfidenceThreshold
=
licensePlateConfigObj
[
"recConfidenceThreshold
"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
carConfidenceMax
=
licensePlateConfigObj
[
"carConfidenceMax"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
carConfidenceMax
=
licensePlateConfigObj
[
"carConfidenceMax"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
carConfidenceMin
=
licensePlateConfigObj
[
"carConfidenceMin"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
carConfidenceMin
=
licensePlateConfigObj
[
"carConfidenceMin"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
licensePlateLen
=
licensePlateConfigObj
[
"licensePlateLen"
].
toInt
();
config
.
licensePlateConfig
.
licensePlateLen
=
licensePlateConfigObj
[
"licensePlateLen"
].
toInt
();
config
.
licensePlateConfig
.
updateAt
=
licensePlateConfigObj
[
"updateAt"
].
toVariant
().
toULongLong
();
config
.
licensePlateConfig
.
updateAt
=
licensePlateConfigObj
[
"updateAt"
].
toVariant
().
toULongLong
();
config
.
licensePlateConfig
.
maxNum
=
licensePlateConfigObj
[
"maxNum"
].
toInt
();
config
.
licensePlateConfig
.
useHalf
=
licensePlateConfigObj
[
"useHalf"
].
toBool
();
config
.
licensePlateConfig
.
boxConfThreshold
=
licensePlateConfigObj
[
"boxConfThreshold"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
nmsThreshold
=
licensePlateConfigObj
[
"nmsThreshold"
].
toVariant
().
toFloat
();
config
.
licensePlateConfig
.
isHigh
=
licensePlateConfigObj
[
"isHigh"
].
toBool
();
// 解析 uniformConfig
// 解析 uniformConfig
QJsonObject
uniformConfigObj
=
dataObj
[
"uniformConfig"
].
toObject
();
QJsonObject
uniformConfigObj
=
dataObj
[
"uniformConfig"
].
toObject
();
...
@@ -547,10 +552,8 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
...
@@ -547,10 +552,8 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
//解析mqttConfig
//解析mqttConfig
QJsonObject
mqttConfigObj
=
dataObj
[
"mqttConfig"
].
toObject
();
QJsonObject
mqttConfigObj
=
dataObj
[
"mqttConfig"
].
toObject
();
config
.
mqttConfig
.
address
=
mqttConfigObj
[
"address"
].
toString
();
config
.
mqttConfig
.
address
=
mqttConfigObj
[
"address"
].
toString
();
config
.
mqttConfig
.
clientId
=
mqttConfigObj
[
"clientId"
].
toString
();
config
.
mqttConfig
.
qos
=
mqttConfigObj
[
"qos"
].
toInt
();
config
.
mqttConfig
.
qos
=
mqttConfigObj
[
"qos"
].
toInt
();
config
.
mqttConfig
.
timeout
=
mqttConfigObj
[
"timeout"
].
toVariant
().
toULongLong
();
config
.
mqttConfig
.
timeout
=
mqttConfigObj
[
"timeout"
].
toVariant
().
toULongLong
();
config
.
mqttConfig
.
topic
=
mqttConfigObj
[
"topic"
].
toString
();
config
.
mqttConfig
.
username
=
mqttConfigObj
[
"username"
].
toString
();
config
.
mqttConfig
.
username
=
mqttConfigObj
[
"username"
].
toString
();
config
.
mqttConfig
.
password
=
mqttConfigObj
[
"password"
].
toString
();
config
.
mqttConfig
.
password
=
mqttConfigObj
[
"password"
].
toString
();
...
...
Httpclient.cpp
View file @
e5fe3f20
...
@@ -7,7 +7,7 @@ HttpClient::HttpClient(QObject *parent)
...
@@ -7,7 +7,7 @@ HttpClient::HttpClient(QObject *parent)
{
{
m_networkAccessManager
=
new
QNetworkAccessManager
(
this
);
m_networkAccessManager
=
new
QNetworkAccessManager
(
this
);
m_timer
=
new
QTimer
(
this
);
m_timer
=
new
QTimer
(
this
);
m_timer
->
setInterval
(
6
000
);
m_timer
->
setInterval
(
10
000
);
m_timer
->
setSingleShot
(
true
);
m_timer
->
setSingleShot
(
true
);
connect
(
m_timer
,
SIGNAL
(
timeout
()),
&
m_eventLoop
,
SLOT
(
quit
()));
connect
(
m_timer
,
SIGNAL
(
timeout
()),
&
m_eventLoop
,
SLOT
(
quit
()));
}
}
...
...
LicensePlateRecognition.cpp
View file @
e5fe3f20
...
@@ -4,22 +4,23 @@
...
@@ -4,22 +4,23 @@
LicensePlateRecognition
::
LicensePlateRecognition
(
const
QString
&
modelPaths
,
float
carConfidence
,
bool
is_high
)
{
LicensePlateRecognition
::
LicensePlateRecognition
(
const
QString
&
modelPaths
,
bool
is_high
,
int
maxNum
,
bool
useHalf
,
float
boxThreshold
,
float
nmsThreshold
,
float
recThreshold
)
{
HLPR_ContextConfiguration
configuration
=
{
0
};
HLPR_ContextConfiguration
configuration
=
{
0
};
QByteArray
&&
by_mpath
=
modelPaths
.
toUtf8
();
QByteArray
&&
by_mpath
=
modelPaths
.
toUtf8
();
char
*
m_path
=
by_mpath
.
data
();
char
*
m_path
=
by_mpath
.
data
();
configuration
.
models_path
=
m_path
;
configuration
.
models_path
=
m_path
;
configuration
.
max_num
=
5
;
configuration
.
max_num
=
maxNum
;
if
(
is_high
){
if
(
is_high
){
configuration
.
det_level
=
DETECT_LEVEL_HIGH
;
configuration
.
det_level
=
DETECT_LEVEL_HIGH
;
}
else
{
}
else
{
configuration
.
det_level
=
DETECT_LEVEL_LOW
;
configuration
.
det_level
=
DETECT_LEVEL_LOW
;
}
}
configuration
.
use_half
=
false
;
configuration
.
use_half
=
useHalf
;
configuration
.
nms_threshold
=
0.5
f
;
configuration
.
nms_threshold
=
nmsThreshold
;
configuration
.
rec_confidence_threshold
=
carConfidence
;
configuration
.
rec_confidence_threshold
=
recThreshold
;
configuration
.
box_conf_threshold
=
0.30
f
;
configuration
.
box_conf_threshold
=
boxThreshold
;
configuration
.
threads
=
1
;
configuration
.
threads
=
1
;
ctx
=
HLPR_CreateContext
(
&
configuration
);
ctx
=
HLPR_CreateContext
(
&
configuration
);
}
}
...
...
LicensePlateRecognition.h
View file @
e5fe3f20
...
@@ -29,7 +29,9 @@ public:
...
@@ -29,7 +29,9 @@ public:
void
replaceWith1And0
(
QString
&
code
);
void
replaceWith1And0
(
QString
&
code
);
LicensePlateRecognition
(
const
QString
&
modelPaths
,
float
carConfidence
,
bool
is_high
);
LicensePlateRecognition
(
const
QString
&
modelPaths
,
bool
is_high
,
int
maxNum
,
bool
useHalf
,
float
boxThreshold
,
float
nmsThreshold
,
float
recThreshold
);
LicensePlateRecognition
();
LicensePlateRecognition
();
...
...
MqttSubscriber.cpp
View file @
e5fe3f20
...
@@ -118,13 +118,14 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
...
@@ -118,13 +118,14 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
CameraHandle
*
cameraHandle
=
MainWindow
::
sp_this
->
findHandle
(
response
.
sn
);
CameraHandle
*
cameraHandle
=
MainWindow
::
sp_this
->
findHandle
(
response
.
sn
);
if
(
cameraHandle
==
nullptr
){
if
(
cameraHandle
==
nullptr
){
qInfo
()
<<
"不存在该相机"
;
qInfo
()
<<
"不存在该相机"
;
re
turn
1
;
re
s
=-
1
;
}
}
else
{
if
(
response
.
msg_type
==
2
){
if
(
response
.
msg_type
==
2
){
res
=
cameraHandle
->
deviceShutdown
();
res
=
cameraHandle
->
deviceShutdown
();
}
}
if
(
response
.
msg_type
==
3
){
if
(
response
.
msg_type
==
3
){
res
=
cameraHandle
->
deviceReboot
(
false
);
res
=
cameraHandle
->
deviceReboot
();
}
}
}
vides_data
::
requestMqttData
request
;
vides_data
::
requestMqttData
request
;
qInfo
()
<<
"res"
<<
res
;
qInfo
()
<<
"res"
<<
res
;
...
...
VidesData.h
View file @
e5fe3f20
...
@@ -258,15 +258,19 @@ struct FaceConfig {
...
@@ -258,15 +258,19 @@ struct FaceConfig {
struct
LicensePlateConfig
{
struct
LicensePlateConfig
{
bool
isOn
;
bool
isOn
;
float
carConfidence
;
float
carConfidenceMax
;
float
carConfidenceMax
;
float
carConfidenceMin
;
float
carConfidenceMin
;
int
licensePlateLen
;
int
licensePlateLen
;
quint64
updateAt
;
quint64
updateAt
;
bool
is_high
;
int
maxNum
;
///< 识别最大数量
bool
useHalf
;
///< 是否使用半精度推理模式
float
boxConfThreshold
;
///< 检测框阈值
float
nmsThreshold
;
///< 非极大值抑制阈值
float
recConfidenceThreshold
;
///< 识别置信度阈值
bool
isHigh
;
};
};
struct
UniformConfig
{
struct
UniformConfig
{
bool
isOn
;
bool
isOn
;
int
uniformColor
;
int
uniformColor
;
...
@@ -307,6 +311,24 @@ struct requestMqttData{
...
@@ -307,6 +311,24 @@ struct requestMqttData{
int
code
;
int
code
;
QString
uniq
;
QString
uniq
;
};
};
struct
DetectionParams
{
int
newHumanDetectionLen
;
int
newLicensePlateLen
;
int
newFaceLen
;
QString
modelPaths
;
float
humanCarShapeConfidence
;
int
uniformColor
;
std
::
map
<
QString
,
QString
>
faceMaps
;
int
numberFaces
;
float
faceConfidence
;
__uint8_t
algorithmPermissions
;
bool
isHigh
;
int
maxNum
;
///< 识别最大数量
bool
useHalf
;
///< 是否使用半精度推理模式
float
boxConfThreshold
;
///< 检测框阈值
float
nmsThreshold
;
///< 非极大值抑制阈值
float
recConfidenceThreshold
;
///< 识别置信度阈值
};
inline
bool
isVirtualMachine
()
inline
bool
isVirtualMachine
()
{
{
...
...
cameravideo
0 → 100755
View file @
e5fe3f20
File added
gamera_videos.pro
View file @
e5fe3f20
...
@@ -25,6 +25,9 @@ INCLUDEPATH+=/usr/local/include/human
...
@@ -25,6 +25,9 @@ INCLUDEPATH+=/usr/local/include/human
INCLUDEPATH
+=/
usr
/
local
/
include
/
CImg
INCLUDEPATH
+=/
usr
/
local
/
include
/
CImg
INCLUDEPATH
+=/
usr
/
local
/
include
/
mqtt
INCLUDEPATH
+=/
usr
/
local
/
include
/
mqtt
# 禁用所有警告
QMAKE_CXXFLAGS
+=
-
w
#unix:contains(QMAKE_HOST.arch, x86_64) {
#unix:contains(QMAKE_HOST.arch, x86_64) {
# QMAKE_LIBDIR += /home/mark/Public/x86_opencv/lib
# QMAKE_LIBDIR += /home/mark/Public/x86_opencv/lib
#}
#}
...
...
mainwindow.cpp
View file @
e5fe3f20
...
@@ -70,13 +70,20 @@ MainWindow::MainWindow()
...
@@ -70,13 +70,20 @@ MainWindow::MainWindow()
float
carShapeConfidence
=
config
.
uniformConfig
.
carShapeConfidence
;
float
carShapeConfidence
=
config
.
uniformConfig
.
carShapeConfidence
;
float
carConfidence
=
config
.
licensePlateConfig
.
carConfidence
;
bool
is_high
=
config
.
licensePlateConfig
.
isHigh
;
bool
is_high
=
config
.
licensePlateConfig
.
is_high
;
int
maxNum
=
config
.
licensePlateConfig
.
maxNum
;
bool
useHalf
=
config
.
licensePlateConfig
.
useHalf
;
float
boxThreshold
=
config
.
licensePlateConfig
.
boxConfThreshold
;
float
nmsThreshold
=
config
.
licensePlateConfig
.
nmsThreshold
;
float
recThreshold
=
config
.
licensePlateConfig
.
recConfidenceThreshold
;
AlgorithmTaskManage
&
algorithmTaskManage
=
AlgorithmTaskManage
::
getInstance
();
AlgorithmTaskManage
&
algorithmTaskManage
=
AlgorithmTaskManage
::
getInstance
();
algorithmTaskManage
.
initialize
(
humanDetectionLen
,
licensePlateLen
,
faceLen
,
true
,
0x00
);
algorithmTaskManage
.
initialize
(
humanDetectionLen
,
licensePlateLen
,
faceLen
,
true
,
0x00
);
algorithmTaskManage
.
initHumanDetectionManage
(
modelPaths
,
carShapeConfidence
,
uniformColor
);
algorithmTaskManage
.
initHumanDetectionManage
(
modelPaths
,
carShapeConfidence
,
uniformColor
);
algorithmTaskManage
.
initLicensePlateManage
(
modelPaths
,
carConfidence
,
is_high
);
algorithmTaskManage
.
initLicensePlateManage
(
modelPaths
,
is_high
,
maxNum
,
useHalf
,
boxThreshold
,
nmsThreshold
,
recThreshold
);
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
MediaFaceImage
*
mediaFaceImage
=
MediaFaceImage
::
getInstance
();
QString
configPath
=
qSetting
->
value
(
"devices/sz_config_path"
).
toString
();
QString
configPath
=
qSetting
->
value
(
"devices/sz_config_path"
).
toString
();
...
@@ -122,7 +129,9 @@ MainWindow::MainWindow()
...
@@ -122,7 +129,9 @@ MainWindow::MainWindow()
qDebug
()
<<
"Server started, listening on port 12345"
;
qDebug
()
<<
"Server started, listening on port 12345"
;
}
}
config
.
mqttConfig
.
clientId
=
serialNumber
;
QString
topic
=
QStringLiteral
(
"/thingshub/%1/device/reply"
).
arg
(
serialNumber
);
config
.
mqttConfig
.
topic
=
topic
;
this
->
mqttConfig
=
config
.
mqttConfig
;
this
->
mqttConfig
=
config
.
mqttConfig
;
MqttSubscriber
*
subscriber
=
MqttSubscriber
::
getInstance
(
mqttConfig
);
MqttSubscriber
*
subscriber
=
MqttSubscriber
::
getInstance
(
mqttConfig
);
subscriber
->
start
();
subscriber
->
start
();
...
@@ -155,14 +164,29 @@ void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig ){
...
@@ -155,14 +164,29 @@ void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig ){
if
(
!
faceAlgorithm
&&
!
licensePlateAlgorithm
&&
!
uniformAlgorithm
&&
!
timeChange
){
if
(
!
faceAlgorithm
&&
!
licensePlateAlgorithm
&&
!
uniformAlgorithm
&&
!
timeChange
){
return
;
return
;
}
}
bool
is_high
=
cloudConfig
.
licensePlateConfig
.
is_high
;
__uint8_t
alg
=
this
->
intToUint8t
(
faceAlgorithm
,
licensePlateAlgorithm
,
uniformAlgorithm
)
;
__uint8_t
alg
=
this
->
intToUint8t
(
faceAlgorithm
,
licensePlateAlgorithm
,
uniformAlgorithm
)
;
algorithmTaskManage
.
releaseResources
(
cloudConfig
.
uniformConfig
.
humanDetectionLen
,
cloudConfig
.
licensePlateConfig
.
licensePlateLen
,
vides_data
::
DetectionParams
params
;
cloudConfig
.
faceConfig
.
faceLen
,
modelPaths
,
cloudConfig
.
uniformConfig
.
carShapeConfidence
params
.
newHumanDetectionLen
=
cloudConfig
.
uniformConfig
.
humanDetectionLen
;
,
cloudConfig
.
uniformConfig
.
uniformColor
,
cloudConfig
.
licensePlateConfig
.
carConfidence
,
localImageMap
,
params
.
newLicensePlateLen
=
cloudConfig
.
licensePlateConfig
.
licensePlateLen
;
cloudConfig
.
faceConfig
.
faceNumbers
,
cloudConfig
.
faceConfig
.
confidence
,
alg
,
is_high
);
params
.
newFaceLen
=
cloudConfig
.
faceConfig
.
faceLen
;
params
.
modelPaths
=
modelPaths
;
params
.
humanCarShapeConfidence
=
cloudConfig
.
uniformConfig
.
carShapeConfidence
;
params
.
uniformColor
=
cloudConfig
.
uniformConfig
.
uniformColor
;
params
.
faceMaps
=
localImageMap
;
params
.
numberFaces
=
cloudConfig
.
faceConfig
.
faceNumbers
;
params
.
faceConfidence
=
cloudConfig
.
faceConfig
.
confidence
;
params
.
algorithmPermissions
=
alg
;
params
.
isHigh
=
cloudConfig
.
licensePlateConfig
.
isHigh
;
params
.
maxNum
=
cloudConfig
.
licensePlateConfig
.
maxNum
;
params
.
useHalf
=
cloudConfig
.
licensePlateConfig
.
useHalf
;
params
.
boxConfThreshold
=
cloudConfig
.
licensePlateConfig
.
boxConfThreshold
;
params
.
nmsThreshold
=
cloudConfig
.
licensePlateConfig
.
nmsThreshold
;
params
.
recConfidenceThreshold
=
cloudConfig
.
licensePlateConfig
.
recConfidenceThreshold
;
algorithmTaskManage
.
releaseResources
(
params
);
if
(
config
.
timerSettings
.
updateAt
!=
cloudConfig
.
timerSettings
.
updateAt
){
if
(
config
.
timerSettings
.
updateAt
!=
cloudConfig
.
timerSettings
.
updateAt
){
if
(
config
.
timerSettings
.
deleteLogFileTimer
!=
cloudConfig
.
timerSettings
.
deleteLogFileTimer
){
if
(
config
.
timerSettings
.
deleteLogFileTimer
!=
cloudConfig
.
timerSettings
.
deleteLogFileTimer
){
deleteLogFileTimer
->
stop
();
deleteLogFileTimer
->
stop
();
...
@@ -514,7 +538,7 @@ void MainWindow::startCamera(const QString &httpurl){
...
@@ -514,7 +538,7 @@ void MainWindow::startCamera(const QString &httpurl){
else
{
else
{
CameraHandle
*
indexHandle
=
findHandle
(
device
.
sSn
);
CameraHandle
*
indexHandle
=
findHandle
(
device
.
sSn
);
if
(
indexHandle
!=
nullptr
&&
device
.
is_reboot
){
if
(
indexHandle
!=
nullptr
&&
device
.
is_reboot
){
indexHandle
->
deviceReboot
(
false
);
indexHandle
->
deviceReboot
();
}
else
{
}
else
{
auto
it
=
this
->
faceDetectionParkingPushs
.
find
(
key
);
auto
it
=
this
->
faceDetectionParkingPushs
.
find
(
key
);
if
(
it
!=
this
->
faceDetectionParkingPushs
.
end
())
{
if
(
it
!=
this
->
faceDetectionParkingPushs
.
end
())
{
...
@@ -963,6 +987,8 @@ void MainWindow::initCameras(vides_data::cameraParameters ¶meter,vides_data:
...
@@ -963,6 +987,8 @@ void MainWindow::initCameras(vides_data::cameraParameters ¶meter,vides_data:
initDevConfigSyn
(
cameraHandle
,
devConfig
);
initDevConfigSyn
(
cameraHandle
,
devConfig
);
cameraHandle
->
sdkDevSetAlarmListener
(
sdk_handle
,
0
);
int
synTime
=
devConfig
.
camera
.
devSnapSynTimer
;
int
synTime
=
devConfig
.
camera
.
devSnapSynTimer
;
uint64
face_frequency
=
devConfig
.
faceConfig
.
faceFrequency
;
uint64
face_frequency
=
devConfig
.
faceConfig
.
faceFrequency
;
...
...
moc_predefs.h
0 → 100644
View file @
e5fe3f20
This diff is collapsed.
Click to expand it.
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