From a6da5c3b77aa722555089b9fb7545332418acda7 Mon Sep 17 00:00:00 2001 From: Jeffrey_Li <412100639@qq.com> Date: Tue, 18 Jul 2023 00:08:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E5=87=A0=E4=B8=AA=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E9=87=8D=E5=A4=8D=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cigarette/alg_jd.cpp | 10 +++++----- Cigarette/alg_jd.h | 2 +- Cigarette/cigarette.cpp | 6 +++--- Cigarette/common.h | 6 ++---- Cigarette/dialogsetup.cpp | 4 ++-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Cigarette/alg_jd.cpp b/Cigarette/alg_jd.cpp index 0e5565b..33bfd26 100644 --- a/Cigarette/alg_jd.cpp +++ b/Cigarette/alg_jd.cpp @@ -22,7 +22,7 @@ static int inpHeight = 416; // Height of network's input image static std::vector classes; -bool AlgJd::init(QString model_path, QString jpg_path) +bool AlgJd::init(QString path_model, QString path_jpg) { // Load names of classes std::string classesFile = "D:/model/jd.names"; @@ -31,8 +31,8 @@ bool AlgJd::init(QString model_path, QString jpg_path) cv::String modelConfiguration = "D:/model/jd.cfg"; cv::String modelWeights; - if (model_path.length() > 0) { - modelWeights = model_path.toStdString(); + if (path_model.length() > 0) { + modelWeights = path_model.toStdString(); } else { modelWeights = "D:/model/jd.weights"; @@ -57,8 +57,8 @@ bool AlgJd::init(QString model_path, QString jpg_path) //cv::Mat image = cv::imread("alg_jd.jpg"); cv::Mat image; - if (jpg_path.length() > 0) { - image = cv::imread(jpg_path.toStdString()); + if (path_jpg.length() > 0) { + image = cv::imread(path_jpg.toStdString()); } else { image = cv::imread("D:/Release/alg_jd.bmp"); diff --git a/Cigarette/alg_jd.h b/Cigarette/alg_jd.h index 25263f2..9b3bc83 100644 --- a/Cigarette/alg_jd.h +++ b/Cigarette/alg_jd.h @@ -12,7 +12,7 @@ class AlgJd { public: - bool init(QString model_path, QString jpg_path); + bool init(QString path_model, QString path_jpg); bool test_detect(); bool test_detect_batcht(int shoot); int detect(cv::Mat& in, cv::Mat &out, std::vector > &results); diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index dd1453e..4f2e51a 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -289,7 +289,7 @@ Cigarette::Cigarette(QWidget *parent) { if(SingleCamInfo[i].Detect){ cam_status_mat[i]->setStyleSheet(tr("background-color: rgb(0, 170, 0);")); - if (!alg_jd[i].init(g_sys_conf.model_path,g_sys_conf.jpg_path)) + if (!alg_jd[i].init(g_sys_conf.path_model,g_sys_conf.path_jpg)) { QMessageBox::information(NULL, QStringLiteral("系统自检失败"), QStringLiteral("AI模型1初始化失败,请检查程序完整性"), QMessageBox::Ok); exit(-1); @@ -298,7 +298,7 @@ Cigarette::Cigarette(QWidget *parent) } } #ifdef __DEBUG - alg_test.init(g_sys_conf.model_path,g_sys_conf.jpg_path); + alg_test.init(g_sys_conf.path_model,g_sys_conf.path_jpg); #endif //自动打开所有相机 if (g_sys_conf.auto_open == 1) @@ -2049,7 +2049,7 @@ bool Cigarette::read_sys_config(SysConf &conf) } else if (tmp_key == "MODELPATH") { - conf.path = line.substr(pos + 1).c_str(); + conf.path_model = line.substr(pos + 1).c_str(); } else if (tmp_key == "JPGPATH") { diff --git a/Cigarette/common.h b/Cigarette/common.h index c510d35..382846f 100644 --- a/Cigarette/common.h +++ b/Cigarette/common.h @@ -74,7 +74,7 @@ public: QTime shiftB; //B换班时间 QTime shiftC; //C换班时间 QString location; // 所在地 - QString path; // 模型路径 + QString path_model; // 模型路径 QString path_jpg; // 图片路径 int timing_shift; //是否定时换班,0否,1是 int expo[NumberOfSupportedCameras]; //相机曝光时间,单位微秒 @@ -87,8 +87,6 @@ public: int MonitorPort; int FeedbackPort; int FilePort; - QString model_path; - QString jpg_path; //MonitorPort为数据端口 //MonitorPort+NumberOfSupportedCameras为图像端口 //MonitorPort+NumberOfSupportedCameras*2为发送命令端口,也就是FeedbackPort @@ -108,7 +106,7 @@ public: shift_byhand = 1; timing_shift=0; //是否定时换班,0否,1是 location = ""; - path = ""; + path_model = ""; path_jpg = ""; shiftA.setHMS(0, 0, 0); shiftB.setHMS(0, 0, 0); diff --git a/Cigarette/dialogsetup.cpp b/Cigarette/dialogsetup.cpp index b710a04..b85c5dd 100644 --- a/Cigarette/dialogsetup.cpp +++ b/Cigarette/dialogsetup.cpp @@ -261,7 +261,7 @@ void DialogSetup::on_toolButton_choose_path_released() { else { if (ui.comboBox->findText(WeightsPath) == -1) { ui.comboBox->addItem(WeightsPath); // 鍦╟omboBox涓樉绀烘枃浠惰矾寰 - g_sys_conf.path = WeightsPath; // 灏嗛夋嫨鐨勮矾寰勫啓鍏onf閰嶇疆鏂囦欢涓 + g_sys_conf.path_model = WeightsPath; // 灏嗛夋嫨鐨勮矾寰勫啓鍏onf閰嶇疆鏂囦欢涓 } } } @@ -358,7 +358,7 @@ void DialogSetup::write_config() sprintf(buf, "LOCATION=%s\n", g_sys_conf.location.toStdString().c_str()); cfg_file.write(buf, strlen(buf)); memset(buf, 0, 256); - sprintf(buf, "MODELPATH=%s\n", g_sys_conf.path.toStdString().c_str()); + sprintf(buf, "MODELPATH=%s\n", g_sys_conf.path_model.toStdString().c_str()); cfg_file.write(buf, strlen(buf)); memset(buf, 0, 256); sprintf(buf, "JPGPATH=%s\n", g_sys_conf.path_jpg.toStdString().c_str());