Commit 5fe7062a by “liusq”

增加算法过滤和mark区域

parent 476b9ed9
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "Json_Header/System_TimeZone.h" #include "Json_Header/System_TimeZone.h"
#include "Json_Header/RecordCfg.h" #include "Json_Header/RecordCfg.h"
#include "Json_Header/NetWork_SPVMN.h" #include "Json_Header/NetWork_SPVMN.h"
#include "Json_Header/NetWork_Wifi.h"
#include "Json_Header/SystemInfo.h" #include "Json_Header/SystemInfo.h"
#include "Json_Header/OPMachine.h" #include "Json_Header/OPMachine.h"
#include "mainwindow.h" #include "mainwindow.h"
...@@ -40,8 +41,9 @@ enum CAR_INFORMATION { ...@@ -40,8 +41,9 @@ enum CAR_INFORMATION {
class CameraHandle: public QObject { class CameraHandle: public QObject {
Q_OBJECT Q_OBJECT
public: public:
CameraHandle(QString &url,QString &httpUrl,QString &sSn, int &channel,const QString &modelPaths, CameraHandle(QString &url,QString &httpUrl,QString &sSn, int &channel,
float carConfidence,int imageSave); const QString &modelPaths,
float carConfidence,float carShapeConfidence, int imageSave);
CameraHandle(); CameraHandle();
~CameraHandle(); ~CameraHandle();
int sdkDevLoginSyn(QString sDevId, int nDevPort, QString sUserName, QString sPassword, int nTimeout); int sdkDevLoginSyn(QString sDevId, int nDevPort, QString sUserName, QString sPassword, int nTimeout);
...@@ -54,19 +56,30 @@ public: ...@@ -54,19 +56,30 @@ public:
void clearCameraHandle(); void clearCameraHandle();
void initAlgorithmParameter(float &height_reference);
// void rebindTimer(int hDevice); // void rebindTimer(int hDevice);
void initSdkRealTimeDevSnapSyn(int hDevice,int syn_timer,uint64 face_frequency); void initSdkRealTimeDevSnapSyn(int hDevice,int syn_timer,uint64 face_frequency);
void updateImage(const cv::Mat & frame,qint64 currentTime); void updateImage(const cv::Mat & frame,qint64 currentTime);
void matToBase64(const cv::Mat &image, QByteArray &base64Data); void matToBase64(const cv::Mat &image, QByteArray &base64Data);
//把原始图片转换成不同区域的掩码
void matToAreaMask(const cv::Mat &source,std::map<int,cv::Mat> &maskFrame);
int callbackFunction(XSDK_HANDLE hObject,QString &szString); int callbackFunction(XSDK_HANDLE hObject,QString &szString);
void checkAndUpdateCurrentPlate(ParkingSpaceInfo*park,const cv::Mat & frame,RecognizedInfo& newInfo,int &result,std::map<int,RecognizedInfo>&exitAndMoMap);
void checkAndUpdateCurrentPlate(ParkingSpaceInfo*park,const cv::Mat & frame,RecognizedInfo& newInfo,int &result);
void licensePlateRecognitionResults(vides_data::requestLicensePlate &location); void licensePlateRecognitionResults(vides_data::requestLicensePlate &location);
void sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel); void sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel);
void printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg);
//设置相机连接的wifi
void sdkWifi(QString &pwd,QString &ssid);
//时间设置 //时间设置
void sdkDevSystemTimeZoneSyn(QString &time); void sdkDevSystemTimeZoneSyn(QString &time);
//录像设置 //录像设置
...@@ -85,13 +98,18 @@ public: ...@@ -85,13 +98,18 @@ public:
void sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id, void sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
QString startTimer,QString endTime); QString startTimer,QString endTime);
void batchRegionalPushLicensePlate(QByteArray &imgs,qint64 currentTime,vides_data::requestLicensePlate &newPlate);
void faceUniformOverlap(std::map<QString,vides_data::requestFaceReconition>&mapFaces,
std::vector<vides_data::ParkingArea> &uniforms,
std::list<QString>&outUniforms);
bool isClockwise(const std::vector<cv::Point2f>& polygon);
QString getSSn(); QString getSSn();
int getMediaHandle(); int getMediaHandle();
void setMediaHandle(int mediaHandle); void setMediaHandle(int mediaHandle);
void setCurrentFace(int currentFace);
void initAlgorithmPermissions(__uint8_t algorithm); void initAlgorithmPermissions(__uint8_t algorithm);
void initParkingSpaceInfo(const std::list<vides_data::responseArea>&areas); void initParkingSpaceInfo(const std::list<vides_data::responseArea>&areas);
...@@ -103,6 +121,7 @@ public: ...@@ -103,6 +121,7 @@ public:
std::map<QString, QString>&getCurrentData(); std::map<QString, QString>&getCurrentData();
bool isChanged(const QPoint& newInfo, const QPoint& current);
// 检查点是否在多边形内 // 检查点是否在多边形内
bool polygonsOverlap(ParkingSpaceInfo &poly1, ParkingSpaceInfo &poly2); bool polygonsOverlap(ParkingSpaceInfo &poly1, ParkingSpaceInfo &poly2);
// 计算两个多边形的交集面积 // 计算两个多边形的交集面积
...@@ -110,6 +129,8 @@ public: ...@@ -110,6 +129,8 @@ public:
double ccw(const QPointF& a, const QPointF& b, const QPointF& c); double ccw(const QPointF& a, const QPointF& b, const QPointF& c);
void getCurrentFrame(std::vector<uchar> &buffer); void getCurrentFrame(std::vector<uchar> &buffer);
bool isAnyOverlap(ParkingSpaceInfo *parkArea,std::vector<vides_data::ParkingArea> &currentPlates);
int findPointRegion(ParkingSpaceInfo &prakArea); int findPointRegion(ParkingSpaceInfo &prakArea);
int determineArea(ParkingSpaceInfo &prakArea); int determineArea(ParkingSpaceInfo &prakArea);
signals: signals:
...@@ -131,9 +152,6 @@ private : ...@@ -131,9 +152,6 @@ private :
SXSDKLoginParam *loginParam; SXSDKLoginParam *loginParam;
SXMediaFaceImageReq *sxMediaFaceImageReq; SXMediaFaceImageReq *sxMediaFaceImageReq;
std::mutex plateMutex;
std::mutex faceMutex;
QString sSn; QString sSn;
QString url; QString url;
std::map<int, vides_data::responseRecognitionData> videoCurrentData; std::map<int, vides_data::responseRecognitionData> videoCurrentData;
...@@ -144,8 +162,9 @@ private : ...@@ -144,8 +162,9 @@ private :
std::map<int,ParkingSpaceInfo*>parkMap; std::map<int,ParkingSpaceInfo*>parkMap;
//当前相机监视所以车位区域 //当前相机监视所以车位区域
std::vector<ParkingSpaceInfo*>parkingSpaceInfos; std::vector<ParkingSpaceInfo*>parkingSpaceInfos;
//当前人脸数 //当前人脸数和工作人数
int currentFace; QPoint faceMapWorker;
int mediaHandle; int mediaHandle;
//2秒钟抓一次图 //2秒钟抓一次图
......
...@@ -62,8 +62,8 @@ private: ...@@ -62,8 +62,8 @@ private:
QString videoOut; QString videoOut;
QString videoDownload; QString videoDownload;
QString images; QString images;
double carConfidenceMax; float carConfidenceMax;
double carConfidenceMin; float carConfidenceMin;
Common(); Common();
~Common(); ~Common();
......
...@@ -209,6 +209,7 @@ void FaceReconition::doesItExistEmployee(const cv::Mat &source,std::list<vides_d ...@@ -209,6 +209,7 @@ void FaceReconition::doesItExistEmployee(const cv::Mat &source,std::list<vides_d
HInt32 featureNum; HInt32 featureNum;
HF_GetFeatureLength(ctxHandle, &featureNum); HF_GetFeatureLength(ctxHandle, &featureNum);
for(int j=0;j< multipleFaceData.detectedNum; ++j){ for(int j=0;j< multipleFaceData.detectedNum; ++j){
qDebug()<<QString("doesItExistEmployee==>面部索引: %1").arg(j);
std::vector<float> newfeature(featureNum,0.0f); std::vector<float> newfeature(featureNum,0.0f);
ret = HF_FaceFeatureExtractCpy(ctxHandle, imageSteamHandle, multipleFaceData.tokens[j], newfeature.data()); ret = HF_FaceFeatureExtractCpy(ctxHandle, imageSteamHandle, multipleFaceData.tokens[j], newfeature.data());
if(ret != HSUCCEED) { if(ret != HSUCCEED) {
......
...@@ -190,7 +190,6 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque ...@@ -190,7 +190,6 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque
}; };
item.insert("camera_location", cameraObject); item.insert("camera_location", cameraObject);
item.insert("img", QJsonValue::fromVariant(plate.img)); // 替换为真实的图像数据 item.insert("img", QJsonValue::fromVariant(plate.img)); // 替换为真实的图像数据
QJsonObject locationObject { QJsonObject locationObject {
{"bottom_right_corner_x", plate.recognition.bottomRightCornerX}, {"bottom_right_corner_x", plate.recognition.bottomRightCornerX},
...@@ -245,9 +244,11 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque ...@@ -245,9 +244,11 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque
// 将 res 添加到结果列表或进行其他操作 // 将 res 添加到结果列表或进行其他操作
} }
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qDebug()<<"httpLicensePlateRecognition"<<m_httpClient.errorCode();
qDebug()<<"httpLicensePlateRecognition msg"<<m_httpClient.errorString();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=m_httpClient.errorString();
} }
return resp; return resp;
} }
...@@ -288,12 +289,12 @@ vides_data::response* HttpService::httpFindFaceReconition(QString &serialNumber, ...@@ -288,12 +289,12 @@ vides_data::response* HttpService::httpFindFaceReconition(QString &serialNumber,
return resp; return resp;
} }
vides_data::response *HttpService::httpPostUniforms(QByteArray &img,int &number,QString sn,qint64 time){ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,QString &id,QString sn,qint64 time){
httpUrl.append("/api/v1.0/recongnition/uniform"); httpUrl.append("/api/v1.0/recongnition/uniform");
QJsonObject json; QJsonObject json;
json.insert("img", QJsonValue::fromVariant(img)); json.insert("img", QJsonValue::fromVariant(img));
json.insert("sn",sn); json.insert("sn",sn);
json.insert("number",number); json.insert("id",id);
json.insert("time",QJsonValue::fromVariant(time)); json.insert("time",QJsonValue::fromVariant(time));
QJsonDocument jsonDoc; QJsonDocument jsonDoc;
jsonDoc.setObject(json); jsonDoc.setObject(json);
...@@ -320,12 +321,21 @@ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,int &number, ...@@ -320,12 +321,21 @@ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,int &number,
return resp; return resp;
} }
vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &number,QString sn,qint64 time){ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &human,int &worker,QString sn,qint64 time){
httpUrl.append("/api/v1.0/recongnition/population"); httpUrl.append("/api/v1.0/recongnition/population");
QJsonObject json; QJsonObject json;
json.insert("img", QJsonValue::fromVariant(img)); json.insert("img", QJsonValue::fromVariant(img));
json.insert("sn",sn); json.insert("sn",sn);
json.insert("number",number);
QJsonObject jsonObject;
jsonObject.insert("human",human);
jsonObject.insert("worker", worker);
// 使用QJsonDocument来转换为字符串
QJsonDocument humanData(jsonObject);
QString jsonString = QString::fromUtf8(humanData.toJson(QJsonDocument::Compact));
json.insert("desc",jsonString);
json.insert("time",QJsonValue::fromVariant(time)); json.insert("time",QJsonValue::fromVariant(time));
QJsonDocument jsonDoc; QJsonDocument jsonDoc;
jsonDoc.setObject(json); jsonDoc.setObject(json);
......
...@@ -34,10 +34,10 @@ public: ...@@ -34,10 +34,10 @@ public:
//人脸识别推送 //人脸识别推送
vides_data::response *httpPostFaceReconition(vides_data::requestFaceReconition & faceReconition); vides_data::response *httpPostFaceReconition(vides_data::requestFaceReconition & faceReconition);
//人数变化推送 //人数变化推送
vides_data::response *httpPostFacePopulation(QByteArray &img,int &number,QString sn,qint64 time); vides_data::response *httpPostFacePopulation(QByteArray &img,int &human,int &worker,QString sn,qint64 time);
//工服推送 //工服推送
vides_data::response *httpPostUniforms(QByteArray &img,int &number,QString sn,qint64 time); vides_data::response *httpPostUniforms(QByteArray &img,QString &id,QString sn,qint64 time);
//客户端组列表 //客户端组列表
vides_data::response *httpFindStream(QString &serialNumber); vides_data::response *httpFindStream(QString &serialNumber);
...@@ -57,6 +57,7 @@ private: ...@@ -57,6 +57,7 @@ private:
QString httpUrl; QString httpUrl;
HttpClient m_httpClient; HttpClient m_httpClient;
QMutex m_httpClientMutex; QMutex m_httpClientMutex;
}; };
......
#ifndef HUMANDETECTION_H #ifndef HUMANDETECTION_H
#define HUMANDETECTION_H #define HUMANDETECTION_H
#include "VidesData.h"
#include "so_human_sdk.h" #include "so_human_sdk.h"
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#include <QDebug> #include <QDebug>
...@@ -9,17 +10,21 @@ public: ...@@ -9,17 +10,21 @@ public:
HumanDetection(); HumanDetection();
~HumanDetection(); ~HumanDetection();
void initDetector(); void initDetector();
int findHuManCar(const cv::Mat &source,int res,TCV_HumanDetector *detector); int findHuManCar(const cv::Mat &source,int res,TCV_HumanDetector *detector,std::vector<vides_data::ParkingArea> &currentPlate);
static HumanDetection& getInstance() static HumanDetection& getInstance()
{ {
static HumanDetection instance; static HumanDetection instance;
return instance; return instance;
} }
void setHeightReference(float &height_reference);
void draw_human_on_image(const cv::Mat& image, const TCV_ObjectLocation* boxes, int size);
private: private:
static HumanDetection* instance; static HumanDetection* instance;
//高度基准
float height_reference;
}; };
......
...@@ -46,7 +46,7 @@ void LicensePlateRecognition::oldLicensePlateNumber(const cv::Mat &source,const ...@@ -46,7 +46,7 @@ void LicensePlateRecognition::oldLicensePlateNumber(const cv::Mat &source,const
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 = 5;
configuration.det_level = DETECT_LEVEL_LOW; configuration.det_level = DETECT_LEVEL_HIGH;
configuration.use_half = false; configuration.use_half = false;
configuration.nms_threshold = 0.5f; configuration.nms_threshold = 0.5f;
configuration.rec_confidence_threshold = 0.8f; configuration.rec_confidence_threshold = 0.8f;
...@@ -89,7 +89,29 @@ void LicensePlateRecognition::oldLicensePlateNumber(const cv::Mat &source,const ...@@ -89,7 +89,29 @@ void LicensePlateRecognition::oldLicensePlateNumber(const cv::Mat &source,const
HLPR_ReleaseContext(ctx1); HLPR_ReleaseContext(ctx1);
} }
void LicensePlateRecognition::replaceWith1And0(QString &code) {
code.replace(QRegularExpression("[Ii]"), "1");
code.replace(QRegularExpression("[Oo]"), "0");
}
void LicensePlateRecognition::filterLicensePlateConfidenceMax(vides_data::requestLicensePlate &plate, vides_data::LicensePlate &max) {
std::list<vides_data::LicensePlate> &plates = plate.plates; // 使用引用避免复制列表
if (plates.empty()) { // 检查列表是否为空
// 如果列表为空,可能需要设定一个默认值或者抛出异常,这里简单地不改变max
return;
}
max = plates.front(); // 初始化max为第一个元素
float maxConfidence = max.text_confidence;
for (auto it = plates.begin(); it != plates.end(); ++it) {
if (it->text_confidence > maxConfidence) {
max = *it; // 发现更高信心值的LicensePlate,更新max
maxConfidence = it->text_confidence;
}
}
}
void LicensePlateRecognition::licensePlateNumber(const cv::Mat &source, QString &lpNumber,vides_data::requestLicensePlate &plate, void LicensePlateRecognition::licensePlateNumber(const cv::Mat &source, QString &lpNumber,vides_data::requestLicensePlate &plate,
qint64 currentTime,P_HLPR_Context ctx) { qint64 currentTime,P_HLPR_Context ctx) {
...@@ -130,7 +152,10 @@ void LicensePlateRecognition::licensePlateNumber(const cv::Mat &source, QString ...@@ -130,7 +152,10 @@ void LicensePlateRecognition::licensePlateNumber(const cv::Mat &source, QString
vides_data::LicensePlate newPlate; vides_data::LicensePlate newPlate;
newPlate.time=currentTime; newPlate.time=currentTime;
newPlate.new_color=QString::fromStdString(type); newPlate.new_color=QString::fromStdString(type);
newPlate.new_plate=QString::fromUtf8(results.plates[i].code); QString car_nuber=QString::fromUtf8(results.plates[i].code);
replaceWith1And0(car_nuber);
qDebug()<<"I O (i o)大小写替换为 1 0结果:==>"<<car_nuber;
newPlate.new_plate=car_nuber;
newPlate.text_confidence=results.plates[i].text_confidence; newPlate.text_confidence=results.plates[i].text_confidence;
vides_data::ParkingArea area; vides_data::ParkingArea area;
area.topLeftCornerX=results.plates[i].x1; area.topLeftCornerX=results.plates[i].x1;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <QFile> #include <QFile>
#include <QImage> #include <QImage>
#include <mutex> #include <mutex>
#include <QRegularExpression>
const std::vector<std::string> types = const std::vector<std::string> types =
{"蓝牌", "黄牌单层", "白牌单层", "绿牌新能源", "黑牌港澳", {"蓝牌", "黄牌单层", "白牌单层", "绿牌新能源", "黑牌港澳",
...@@ -24,10 +25,11 @@ public: ...@@ -24,10 +25,11 @@ public:
void licensePlateNumber(const cv::Mat &source,QString & lpNumber, vides_data::requestLicensePlate &plate, void licensePlateNumber(const cv::Mat &source,QString & lpNumber, vides_data::requestLicensePlate &plate,
qint64 currentTime,P_HLPR_Context ctx); qint64 currentTime,P_HLPR_Context ctx);
void filterLicensePlateConfidenceMax(vides_data::requestLicensePlate &plate,vides_data::LicensePlate &max);
void oldLicensePlateNumber(const cv::Mat &source,const QString &modelPaths,QString & lpNumber); void oldLicensePlateNumber(const cv::Mat &source,const QString &modelPaths,QString & lpNumber);
// void initHlprContext(const QString &modelPaths,const QString &carCascade,float carConfidence); // void initHlprContext(const QString &modelPaths,const QString &carCascade,float carConfidence);
void replaceWith1And0( QString &code);
private: private:
static LicensePlateRecognition* instance; static LicensePlateRecognition* instance;
......
...@@ -58,7 +58,7 @@ static int sdkInitCallback(XSDK_HANDLE hObject, int nMsgId, int nParam1, ...@@ -58,7 +58,7 @@ static int sdkInitCallback(XSDK_HANDLE hObject, int nMsgId, int nParam1,
QString qString(szString); QString qString(szString);
CameraHandle* cameraHandle= mediaFaceImage->getCurrentDevice().at(hObject); CameraHandle* cameraHandle= mediaFaceImage->getCurrentDevice().at(hObject);
QThreadPool* threadPool = QThreadPool::globalInstance(); QThreadPool* threadPool = QThreadPool::globalInstance();
threadPool->setMaxThreadCount(12);
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);
// task->setAutoDelete(false); // 确保task不会在执行后被自动删除 // task->setAutoDelete(false); // 确保task不会在执行后被自动删除
......
...@@ -9,12 +9,15 @@ public: ...@@ -9,12 +9,15 @@ public:
ParkingSpaceInfo(RecognizedInfo & currentPlate); ParkingSpaceInfo(RecognizedInfo & currentPlate);
ParkingSpaceInfo(); ParkingSpaceInfo();
~ParkingSpaceInfo(); ~ParkingSpaceInfo();
RecognizedInfo& getCurrentPlate(); RecognizedInfo& getCurrentPlate();
void setCurrentPlate(RecognizedInfo & current); void setCurrentPlate(RecognizedInfo & current);
void addQueue(RecognizedInfo &info); void addQueue(RecognizedInfo &info);
void removeQueue(); void removeQueue();
void removeNoQueue(); void removeNoQueue();
QQueue<RecognizedInfo> &getQueue(); QQueue<RecognizedInfo> &getQueue();
void setArea(vides_data::ParkingArea &a); void setArea(vides_data::ParkingArea &a);
vides_data::ParkingArea &getArea(); vides_data::ParkingArea &getArea();
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
#include <QTextStream> #include <QTextStream>
#include <QByteArray> #include <QByteArray>
#include <QNetworkInterface> #include <QNetworkInterface>
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <list> #include <list>
namespace vides_data{ namespace vides_data{
constexpr const char *HEADER_TYPE_KAY="Content-Type"; constexpr const char *HEADER_TYPE_KAY="Content-Type";
...@@ -147,7 +151,7 @@ struct LicensePlate ...@@ -147,7 +151,7 @@ struct LicensePlate
QString new_color; QString new_color;
QByteArray img; QByteArray img;
qint64 time; qint64 time;
ParkingArea recognition; ParkingArea recognition;//识别区域
float text_confidence; float text_confidence;
LicensePlate() {} LicensePlate() {}
}; };
...@@ -258,6 +262,7 @@ inline QString getDefaultGateway() { ...@@ -258,6 +262,7 @@ inline QString getDefaultGateway() {
#endif #endif
return gateway; return gateway;
} }
inline bool pingAddress(const QString &address) { inline bool pingAddress(const QString &address) {
QProcess process; QProcess process;
QString program = "ping"; QString program = "ping";
......
QT += core gui network multimedia sql concurrent QT += core gui network multimedia sql concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 CONFIG += c++11
...@@ -11,46 +12,46 @@ TEMPLATE = app ...@@ -11,46 +12,46 @@ TEMPLATE = app
# depend on your compiler). Please consult the documentation of the # depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it. # deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += APP_VERSION=\\\"1.0.1\\\" DEFINES += APP_VERSION=\\\"1.0.2\\\"
QMAKE_LIBDIR += /usr/local/lib #QMAKE_LIBDIR += /usr/local/lib
INCLUDEPATH+=/usr/local/include/opencv4 #INCLUDEPATH+=/usr/local/include/opencv4
INCLUDEPATH+=/usr/local/include/hyperface #INCLUDEPATH+=/usr/local/include/hyperface
INCLUDEPATH+=/usr/local/include/hyper #INCLUDEPATH+=/usr/local/include/hyper
INCLUDEPATH+=/usr/local/include/XNetSDK #INCLUDEPATH+=/usr/local/include/XNetSDK
INCLUDEPATH+=/usr/local/include/human #INCLUDEPATH+=/usr/local/include/human
INCLUDEPATH+=/usr/local/include/CImg #INCLUDEPATH+=/usr/local/include/CImg
#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
#} }
#unix:contains(QMAKE_HOST.arch, arm) { unix:contains(QMAKE_HOST.arch, arm) {
# QMAKE_LIBDIR += /usr/local/lib QMAKE_LIBDIR += /usr/local/lib
#} }
## 根据编译器类型选择库路径和头文件路径 # 根据编译器类型选择库路径和头文件路径
#unix: { unix: {
# # x86 架构 # x86 架构
# contains(QMAKE_HOST.arch, x86_64) { contains(QMAKE_HOST.arch, x86_64) {
# INCLUDEPATH+=/home/mark/Public/x86_opencv/include/opencv4 INCLUDEPATH+=/home/mark/Public/x86_opencv/include/opencv4
# INCLUDEPATH+=/home/mark/Public/x86_opencv/include/hyperface INCLUDEPATH+=/home/mark/Public/x86_opencv/include/hyperface
# INCLUDEPATH+=/home/mark/Public/x86_opencv/include/hyper INCLUDEPATH+=/home/mark/Public/x86_opencv/include/hyper
# INCLUDEPATH+=/home/mark/Public/x86_opencv/include/XNetSDK INCLUDEPATH+=/home/mark/Public/x86_opencv/include/XNetSDK
# INCLUDEPATH+=/home/mark/Public/x86_opencv/include/human INCLUDEPATH+=/home/mark/Public/x86_opencv/include/human
# INCLUDEPATH+=/home/mark/Public/x86_opencv/include/CImg INCLUDEPATH+=/home/mark/Public/x86_opencv/include/CImg
# } }
# # ARM 架构 # ARM 架构
# contains(QMAKE_HOST.arch, arm) { contains(QMAKE_HOST.arch, arm) {
# INCLUDEPATH+=/usr/local/include/opencv4 INCLUDEPATH+=/usr/local/include/opencv4
# INCLUDEPATH+=/usr/local/include/hyperface INCLUDEPATH+=/usr/local/include/hyperface
# INCLUDEPATH+=/usr/local/include/hyper INCLUDEPATH+=/usr/local/include/hyper
# INCLUDEPATH+=/usr/local/include/XNetSDK INCLUDEPATH+=/usr/local/include/XNetSDK
# INCLUDEPATH+=/usr/local/include/human INCLUDEPATH+=/usr/local/include/human
# } }
#} }
# You can also make your code fail to compile if it uses deprecated APIs. # You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
......
...@@ -63,7 +63,17 @@ MainWindow::MainWindow() ...@@ -63,7 +63,17 @@ MainWindow::MainWindow()
connect(dePermissionSynTimer, &QTimer::timeout, this, [this, httpurl](){ connect(dePermissionSynTimer, &QTimer::timeout, this, [this, httpurl](){
this->startCamera(httpurl); this->startCamera(httpurl);
},Qt::QueuedConnection); },Qt::QueuedConnection);
dePermissionSynTimer->start(dePermissionTimer);
this->startCamera(httpurl);
// 设置定时器间隔
dePermissionSynTimer->setInterval(dePermissionTimer);
// 启动定时器
dePermissionSynTimer->start();
//dePermissionSynTimer->start(dePermissionTimer);
//vides_data::scanWiFiNetworks();
connect(&server, &QTcpServer::newConnection, this, &MainWindow::handleMatNewConnection); connect(&server, &QTcpServer::newConnection, this, &MainWindow::handleMatNewConnection);
...@@ -76,6 +86,7 @@ MainWindow::MainWindow() ...@@ -76,6 +86,7 @@ MainWindow::MainWindow()
} }
} }
CameraHandle* MainWindow::findHandle(QString sn){ CameraHandle* MainWindow::findHandle(QString sn){
for (auto it = faceDetectionParkingPushs.begin(); it != faceDetectionParkingPushs.end(); ++it) { for (auto it = faceDetectionParkingPushs.begin(); it != faceDetectionParkingPushs.end(); ++it) {
QString currentSn = it->second->getSSn(); QString currentSn = it->second->getSSn();
...@@ -751,8 +762,11 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,const std:: ...@@ -751,8 +762,11 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,const std::
MediaFaceImage* mediaFaceImage= MediaFaceImage::getInstance(); MediaFaceImage* mediaFaceImage= MediaFaceImage::getInstance();
float carConfidence=qSetting->value("devices/carConfidence").toFloat(); float carConfidence=qSetting->value("devices/carConfidence").toFloat();
int image_save=qSetting->value("devices/image_save").toInt(); int image_save=qSetting->value("devices/image_save").toInt();
float heightReference=qSetting->value("devices/height_reference").toFloat();
CameraHandle * cameraHandle =new CameraHandle(parameter.sDevId,parameter.httpUrl,parameter.sSn,parameter.channel,modelPaths,carConfidence,image_save); float carShapeConfidence=qSetting->value("devices/carShapeConfidence").toFloat();
CameraHandle * cameraHandle =new CameraHandle(parameter.sDevId,parameter.httpUrl,parameter.sSn,parameter.channel,modelPaths,carConfidence,carShapeConfidence,image_save);
int sdk_handle=cameraHandle->sdkDevLoginSyn(parameter.sDevId,parameter.nDevPort,parameter.sUserName,parameter.sPassword,10000); int sdk_handle=cameraHandle->sdkDevLoginSyn(parameter.sDevId,parameter.nDevPort,parameter.sUserName,parameter.sPassword,10000);
qDebug()<<"句柄为2:"<<sdk_handle; qDebug()<<"句柄为2:"<<sdk_handle;
...@@ -763,11 +777,16 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,const std:: ...@@ -763,11 +777,16 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,const std::
initDevConfigSyn(cameraHandle); initDevConfigSyn(cameraHandle);
mediaFaceImage->setMap(sdk_handle,cameraHandle); mediaFaceImage->setMap(sdk_handle,cameraHandle);
cameraHandle->sdkDevSetAlarmListener(sdk_handle,1); cameraHandle->sdkDevSetAlarmListener(sdk_handle,0);
int synTime=qSetting->value("timer/dev_snap_syn_timer").toInt(); int synTime=qSetting->value("timer/dev_snap_syn_timer").toInt();
uint64 face_frequency=qSetting->value("devices/face_frequency").toULongLong(); uint64 face_frequency=qSetting->value("devices/face_frequency").toULongLong();
cameraHandle->initSdkRealTimeDevSnapSyn(sdk_handle,synTime,face_frequency); cameraHandle->initSdkRealTimeDevSnapSyn(sdk_handle,synTime,face_frequency);
cameraHandle->initAlgorithmParameter(heightReference);
QString pwd="admin2024";
QString sid="MERCURY_8C4F";
cameraHandle->sdkWifi(pwd,sid);
vides_data::requestCameraInfo camera_info; vides_data::requestCameraInfo camera_info;
camera_info.sSn=parameter.sSn; camera_info.sSn=parameter.sSn;
camera_info.ip_addr=parameter.sDevId; camera_info.ip_addr=parameter.sDevId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment