更新了推出逻辑避免退出报错

This commit is contained in:
XinJiang1 2025-01-06 14:45:39 +08:00
parent 1ba0432ad2
commit 709ea0f6fd
11 changed files with 183 additions and 172 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
#include "camera.h" #include "camera.h"
#include <QTimer>
// Debug Options // Debug Options
#define GlobalDebug 0 // 全局是否允许打印Debug信息打印会拖慢处理时间 #define GlobalDebug 0 // 全局是否允许打印Debug信息打印会拖慢处理时间
@ -79,7 +78,7 @@ extern int lowmac_td; //偏振红色通道差值
Timer CallBackTimer0; Timer CallBackTimer0;
Timer CallBackTimer1; Timer CallBackTimer1;
// ONNXRunner runner;
bool iniCamera() bool iniCamera()
{ {
//分配application //分配application
@ -135,12 +134,6 @@ bool iniCamera()
return 1; return 1;
} }
// #if(GlobalDebug && DebugDetection)
// // #define SAVE_PATH_resize MIL_TEXT ("C:\\Users\\Pc\\Desktop\\cotton_double2//resize.png")
// #define SAVE_PATH_flip MIL_TEXT ("C:\\Users\\Pc\\Desktop\\cotton_double2//flip.png")
// #define SAVE_PATH_raw MIL_TEXT ("C:\\Users\\Pc\\Desktop\\cotton_double2//raw.png")
// #define SAVE_PATH_result MIL_TEXT ("C:\\Users\\Pc\\Desktop\\cotton_double2//result.png")
// #endif
MIL_INT ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr) MIL_INT ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
{ {
@ -555,12 +548,7 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
//将mask扩展到合适发送的大小 //将mask扩展到合适发送的大小
std::vector<std::vector<uint8_t>> mask_Total = expandArray(mask_expaned,64); std::vector<std::vector<uint8_t>> mask_Total = expandArray(mask_expaned,64);
// save masks
// #if(GlobalDebug && DebugDetection)
// VectorToImg(mask_1,"C:/Users/Pc/Desktop/img/mask" + std::to_string(FuncCount1) + ".bmp");
// VectorToImg(mask_1,"C:/Users/Pc/Desktop/img/mask_ignored" + std::to_string(FuncCount1) + ".bmp");
// VectorToImg(mask_Total,"C:/Users/Pc/Desktop/img/mask_expended" + std::to_string(FuncCount1) + ".bmp");
// #endif
// 发送到下位机 // 发送到下位机
bool result_Low = get_valve_data(mask_Total); bool result_Low = get_valve_data(mask_Total);
if(!result_Low) if(!result_Low)
@ -590,10 +578,13 @@ bool DestoryCamera()
MbufFree(MilImage0); MbufFree(MilImage0);
MbufFree(MilImage1); MbufFree(MilImage1);
MbufFree(MilImage_Color0); MbufFree(MilImage_Color0);
MbufFree(MilImage_Color1); MbufFree(MilImage_Color1);
MdigFree(MilDigitizer0); MdigFree(MilDigitizer0);
MdigFree(MilDigitizer1); MdigFree(MilDigitizer1);
MsysFree(MilSystem); MsysFree(MilSystem);
MappFree(MilApplication); MappFree(MilApplication);
@ -672,14 +663,6 @@ void read_color(const std::string& filename, std::vector<std::string>& colors) {
std::vector<std::vector<uint8_t>> generateMaskFromImage(const MIL_ID& inputImage, int widthBlocks, int heightBlocks, int thresholds= 10) { std::vector<std::vector<uint8_t>> generateMaskFromImage(const MIL_ID& inputImage, int widthBlocks, int heightBlocks, int thresholds= 10) {
// 读取图像
// cv::Mat image = cv::imread(imagePath, cv::IMREAD_GRAYSCALE);
// // 检查图像是否成功读取
// if (image.empty()) {
// std::cerr << "无法加载图像,请检查路径是否正确: " << imagePath << std::endl;
// exit(EXIT_FAILURE);
// }
cv::Mat image=ImageUtils::mil2Mat(inputImage); cv::Mat image=ImageUtils::mil2Mat(inputImage);
// 确保图像是二值化的 // 确保图像是二值化的
cv::threshold(image, image, 128, 255, cv::THRESH_BINARY); cv::threshold(image, image, 128, 255, cv::THRESH_BINARY);
@ -818,12 +801,6 @@ bool iniOnnx()
std::string modelPath = (getConfigDirectory() + "/dimo_369_640.onnx").toStdString(); std::string modelPath = (getConfigDirectory() + "/dimo_369_640.onnx").toStdString();
runner.load(modelPath); runner.load(modelPath);
// cv::Mat mask;
// std::vector<Detection> result = runner.predict(image);
// mask = runner.postProcess(result, image);
// std::string savepath = "C:/Users/admin/Desktop/config/suspect_mask.png";
// cv::imwrite(savepath, mask);
return 1; return 1;
} }
@ -1068,9 +1045,6 @@ bool setLowMacParam(){
bool DestoryLowMac() bool DestoryLowMac()
{ {
MdigProcess(MilDigitizer0, MilGrabBufferList0, 20, M_STOP, M_DEFAULT,ProcessingFunction0, M_NULL);
MdigProcess(MilDigitizer1, MilGrabBufferList1, 20, M_STOP, M_DEFAULT,ProcessingFunction1, M_NULL);
// 构建停止命令 // 构建停止命令
uint8_t stop_command[9] = {0}; uint8_t stop_command[9] = {0};
stop_command[0] = 0xAA; // 起始标志 stop_command[0] = 0xAA; // 起始标志
@ -1161,12 +1135,33 @@ bool get_valve_data(std::vector<std::vector<uint8_t>> mask)
return true; return true;
} }
bool start_grab()
void Start_camera()
{ {
MdigProcess(MilDigitizer0, MilGrabBufferList0, 20, M_START, M_DEFAULT,ProcessingFunction0, M_NULL); try
MdigProcess(MilDigitizer1, MilGrabBufferList1, 20, M_START, M_DEFAULT,ProcessingFunction1, M_NULL); {
MdigProcess(MilDigitizer0, MilGrabBufferList0, 20, M_START, M_DEFAULT,ProcessingFunction0, M_NULL);
MdigProcess(MilDigitizer1, MilGrabBufferList1, 20, M_START, M_DEFAULT,ProcessingFunction1, M_NULL);
} catch (...) {
qWarning() << "Start Grabber Failed!!!";
return false;
}
return true;
}
bool stop_grab()
{ try {
MdigProcess(MilDigitizer0, MilGrabBufferList0, 20, M_STOP, M_DEFAULT,ProcessingFunction0, M_NULL);
MdigProcess(MilDigitizer1, MilGrabBufferList1, 20, M_STOP, M_DEFAULT,ProcessingFunction1, M_NULL);
} catch (...) {
qWarning() << "Stop Grabber Failed!!!";
return false;
}
return true;
}
void start_camera()
{
start_grab();
// 发送开始命令 // 发送开始命令
uint8_t start_command[9] = {0}; uint8_t start_command[9] = {0};
start_command[0] = 0xAA; start_command[0] = 0xAA;
@ -1191,7 +1186,6 @@ void Start_camera()
} }
std::vector<std::vector<uint8_t> > expandArray(const std::vector<std::vector<uint8_t> > &array, int newCols) std::vector<std::vector<uint8_t> > expandArray(const std::vector<std::vector<uint8_t> > &array, int newCols)
{ {
int rows = array.size(); int rows = array.size();

View File

@ -11,6 +11,7 @@
#include <string> #include <string>
#include <future> #include <future>
#include <QTimer>
#include <chrono> #include <chrono>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
@ -23,7 +24,7 @@
#include <QTcpServer> #include <QTcpServer>
#include "globals.h" #include "globals.h"
#include "img_utils.h" #include "img_utils.h"
#include "color_range.h" #include "color_algorithms.h"
extern MIL_ID MilApplication; extern MIL_ID MilApplication;
extern MIL_ID MilSystem; extern MIL_ID MilSystem;
@ -67,7 +68,7 @@ bool iniColor();
bool iniOnnx(); bool iniOnnx();
void Start_camera(); void start_camera();
bool setLowMacParam(); bool setLowMacParam();
@ -75,6 +76,10 @@ bool DestoryCamera();
bool DestoryLowMac(); bool DestoryLowMac();
bool start_grab();
bool stop_grab();
extern int SaveImg_Flag; extern int SaveImg_Flag;
MIL_INT MFTYPE ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void* HookDataPtr); MIL_INT MFTYPE ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void* HookDataPtr);

View File

@ -11,11 +11,12 @@ CONFIG += console
SOURCES += \ SOURCES += \
camera.cpp \ camera.cpp \
color_range.cpp \ color_algorithms.cpp \
countdowndialog.cpp \ countdowndialog.cpp \
detectionworker.cpp \ detectionworker.cpp \
globals.cpp \ globals.cpp \
img_utils.cpp \ img_utils.cpp \
lower_machine.cpp \
main.cpp \ main.cpp \
onnxrunner.cpp \ onnxrunner.cpp \
storageworker.cpp \ storageworker.cpp \
@ -23,11 +24,12 @@ SOURCES += \
HEADERS += \ HEADERS += \
camera.h \ camera.h \
color_range.h \ color_algorithms.h \
countdowndialog.h \ countdowndialog.h \
detectionworker.h \ detectionworker.h \
globals.h \ globals.h \
img_utils.h \ img_utils.h \
lower_machine.h \
onnxrunner.h \ onnxrunner.h \
storageworker.h \ storageworker.h \
widget.h widget.h

View File

@ -12,17 +12,17 @@ blue_a_max = 22
blue_b_min = -48 blue_b_min = -48
blue_b_max = -8 blue_b_max = -8
orange_L_min = 63 orange_L_min = 67
orange_L_max = 78 orange_L_max = 93
orange_a_min = 7 orange_a_min = -8
orange_a_max = 14 orange_a_max = 8
orange_b_min = 23 orange_b_min = 36
orange_b_max = 47 orange_b_max = 58
black_L_min = 0 black_L_min = 0
black_L_max = 8 black_L_max = 30
black_a_min = -4 black_a_min = -5
black_a_max = 2 black_a_max = 3
black_b_min = -3 black_b_min = -3
black_b_max = 4 black_b_max = 4
@ -34,9 +34,9 @@ red_b_min = -80
red_b_max = 37 red_b_max = 37
purple_L_min = 38 purple_L_min = 38
purple_L_max = 54 purple_L_max = 60
purple_a_min = 10 purple_a_min = 10
purple_a_max = 20 purple_a_max = 25
purple_b_min = -45 purple_b_min = -45
purple_b_max = 1 purple_b_max = 1
@ -51,9 +51,12 @@ expansionRaidus = 1
file_delay = 1180 file_delay = 1180
lab_denoising = 1 lab_denoising = 1
lowmac_dp = 350 lowmac_dp = 350
lowmac_sg = 70 lowmac_sg = 60
lowmac_td = 7 lowmac_sm = 1800
lowmac_ts = 10 lowmac_td = 2
lowmac_ts = 13
machine_num = 0
max_valves_together = 20
saturation_denoising = 1 saturation_denoising = 1
saturation_threshold = 165 saturation_threshold = 165
sizeThreshold = 4 sizeThreshold = 4

View File

@ -56,7 +56,7 @@ lowmac_sm = 1200
lowmac_td = 7 lowmac_td = 7
lowmac_ts = 10 lowmac_ts = 10
machine_num = 0 machine_num = 0
max_valves_together = 20 max_valves_together = 18
saturation_denoising = 1 saturation_denoising = 1
saturation_threshold = 165 saturation_threshold = 165
sizeThreshold = 4 sizeThreshold = 4

View File

@ -1988,7 +1988,7 @@ public:
retranslateUi(Widget); retranslateUi(Widget);
tabWidget->setCurrentIndex(3); tabWidget->setCurrentIndex(1);
QMetaObject::connectSlotsByName(Widget); QMetaObject::connectSlotsByName(Widget);
@ -2007,14 +2007,14 @@ public:
btn_take_photos->setText(QCoreApplication::translate("Widget", "\346\212\223\345\217\226\345\233\276\347\211\207", nullptr)); btn_take_photos->setText(QCoreApplication::translate("Widget", "\346\212\223\345\217\226\345\233\276\347\211\207", nullptr));
btn_set_valve->setText(QCoreApplication::translate("Widget", "\350\256\276\347\275\256\345\217\202\346\225\260", nullptr)); btn_set_valve->setText(QCoreApplication::translate("Widget", "\350\256\276\347\275\256\345\217\202\346\225\260", nullptr));
btn_quit->setText(QCoreApplication::translate("Widget", "\351\200\200\345\207\272\347\263\273\347\273\237", nullptr)); btn_quit->setText(QCoreApplication::translate("Widget", "\351\200\200\345\207\272\347\263\273\347\273\237", nullptr));
label_2->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\2721", nullptr)); label_2->setText(QCoreApplication::translate("Widget", "\346\260\224\347\275\220\344\276\247-\347\233\270\346\234\2721", nullptr));
dl_enable_1->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\346\267\261\345\272\246\345\255\246\344\271\240", nullptr)); dl_enable_1->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\346\267\261\345\272\246\345\255\246\344\271\240", nullptr));
tra_enable_1->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\350\211\263\344\270\275\346\243\200\346\265\213", nullptr)); tra_enable_1->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\350\211\263\344\270\275\346\243\200\346\265\213", nullptr));
mtx_1_overlay->setText(QCoreApplication::translate("Widget", "\350\211\262\346\243\200\347\273\223\346\236\234", nullptr)); mtx_1_overlay->setText(QCoreApplication::translate("Widget", "\350\211\262\346\243\200\347\273\223\346\236\234", nullptr));
dl_1_overlay->setText(QCoreApplication::translate("Widget", "\346\231\272\346\243\200\347\273\223\346\236\234", nullptr)); dl_1_overlay->setText(QCoreApplication::translate("Widget", "\346\231\272\346\243\200\347\273\223\346\236\234", nullptr));
img_1_mirror->setText(QCoreApplication::translate("Widget", "\345\233\276\347\211\207\351\225\234\345\203\217", nullptr)); img_1_mirror->setText(QCoreApplication::translate("Widget", "\345\233\276\347\211\207\351\225\234\345\203\217", nullptr));
camera_1_img->setText(QString()); camera_1_img->setText(QString());
label_4->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\2720", nullptr)); label_4->setText(QCoreApplication::translate("Widget", "\345\207\272\351\243\216\345\217\243\344\276\247-\347\233\270\346\234\2720", nullptr));
dl_enable_0->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\346\267\261\345\272\246\345\255\246\344\271\240", nullptr)); dl_enable_0->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\346\267\261\345\272\246\345\255\246\344\271\240", nullptr));
tra_enable_0->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\350\211\263\344\270\275\346\243\200\346\265\213", nullptr)); tra_enable_0->setText(QCoreApplication::translate("Widget", "\345\261\217\350\224\275\350\211\263\344\270\275\346\243\200\346\265\213", nullptr));
mtx_0_overlay->setText(QCoreApplication::translate("Widget", "\350\211\262\346\243\200\347\273\223\346\236\234", nullptr)); mtx_0_overlay->setText(QCoreApplication::translate("Widget", "\350\211\262\346\243\200\347\273\223\346\236\234", nullptr));

View File

@ -28,13 +28,13 @@ using namespace std;
// 硬编码参数值 // 硬编码参数值
int file_delay = 1180; // 延迟时间(毫秒) int file_delay = 1100; // 延迟时间(毫秒)
int file_encoder = 12000; // 行频 int file_encoder = 12000; // 行频
int file_valve = 200; // 喷阀触发频率 int file_valve = 200; // 喷阀触发频率
//下位机参数 //下位机参数
int lowmac_dp = 350; //偏振延迟时间 int lowmac_dp = 350; //偏振延迟时间
int lowmac_sm = 1200; //吹气量 valve/12 = 吹气时间ms int lowmac_sm = 1800; //吹气量 valve/12 = 吹气时间ms
int lowmac_ts = 10; //模板匹配阈值 int lowmac_ts = 10; //模板匹配阈值
int lowmac_sg = 65; //偏振绿色通道大小阈值 int lowmac_sg = 65; //偏振绿色通道大小阈值
int lowmac_td = 7; //偏振红色通道差值 int lowmac_td = 7; //偏振红色通道差值
@ -46,7 +46,7 @@ Widget::Widget(QWidget *parent)
this->isCamRunning = false; this->isCamRunning = false;
ui->setupUi(this); ui->setupUi(this);
// 确认 tabWidget 是 QTabWidget 类型 // 确认 tabWidget 是 QTabWidget 类型并隐藏tab
QTabWidget* tab = qobject_cast<QTabWidget*>(ui->tabWidget); QTabWidget* tab = qobject_cast<QTabWidget*>(ui->tabWidget);
if (tab) { if (tab) {
QTabBar* tabBar = tab->tabBar(); QTabBar* tabBar = tab->tabBar();
@ -58,7 +58,6 @@ Widget::Widget(QWidget *parent)
} else { } else {
qWarning() << "ui->tabWidget 不是 QTabWidget 类型!"; qWarning() << "ui->tabWidget 不是 QTabWidget 类型!";
} }
ui->camera_0_img->setScaledContents(false); ui->camera_0_img->setScaledContents(false);
ui->camera_1_img->setScaledContents(false); ui->camera_1_img->setScaledContents(false);
@ -67,9 +66,14 @@ Widget::Widget(QWidget *parent)
loadConfig(getConfigDirectory()+"/color_range_config.txt"); // 读取配置文件 loadConfig(getConfigDirectory()+"/color_range_config.txt"); // 读取配置文件
iniLowMac(); iniLowMac();
iniCamera(); iniCamera();
update_machine_num();
update_colorlist(); // 更新色彩列表
update_polar(); // 更新偏振相机界面 // 更新界面
update_main_settings(); // 更新主要设定
update_colorlist(); // 更新色彩列表
update_polar(); // 更新偏振相机界面
// 初始化存储工作者和线程 // 初始化存储工作者和线程
storageWorker = new StorageWorker(); storageWorker = new StorageWorker();
storageWorker->moveToThread(&storageThread); storageWorker->moveToThread(&storageThread);
@ -122,6 +126,30 @@ void Widget::onCountdownFinished()
Widget::~Widget() Widget::~Widget()
{ {
// 停止检测工作者线程
for(int i = 0; i < 2; ++i)
{
g_recognitionRunning[i]->store(false);
g_img_Queue[i]->stop(); // 停止队列以唤醒线程
}
// 等待检测工作者线程结束
for(int i = 0; i < 2; ++i)
{
if(g_recognitionThread[i] && g_recognitionThread[i]->joinable())
{
g_recognitionThread[i]->join();
delete g_recognitionThread[i];
g_recognitionThread[i] = nullptr;
}
if(g_recognitionRunning[i])
{
delete g_recognitionRunning[i];
g_recognitionRunning[i] = nullptr;
}
}
// 停止存储线程 // 停止存储线程
g_storageQueue.stop(); g_storageQueue.stop();
storageThread.quit(); storageThread.quit();
@ -352,7 +380,7 @@ void Widget::refreshSingleImage(int camera_id, bool overlay_traditional_result,
return; return;
} }
// 高质量缩放图像 // 缩放图像
QSize labelSize = cameraLabels[camera_id]->size(); QSize labelSize = cameraLabels[camera_id]->size();
QPixmap scaledPixmap = pixmap.scaled(labelSize); QPixmap scaledPixmap = pixmap.scaled(labelSize);
@ -362,13 +390,9 @@ void Widget::refreshSingleImage(int camera_id, bool overlay_traditional_result,
void Widget::on_pushButton_2_clicked()
{
SaveImg_Flag = 1;
}
void Widget::on_btn_stop_clicked() void Widget::on_btn_stop_clicked()
{ {
stop_grab();
DestoryLowMac(); DestoryLowMac();
this->isCamRunning = false; this->isCamRunning = false;
@ -416,7 +440,7 @@ void Widget::on_btn_start_clicked()
std::cerr << "SET thread " << i << " failed, error code" << GetLastError() << std::endl; std::cerr << "SET thread " << i << " failed, error code" << GetLastError() << std::endl;
} }
} }
Start_camera(); start_camera();
} }
@ -434,33 +458,6 @@ void Widget::on_btn_take_photos_released()
void Widget::on_btn_quit_clicked() void Widget::on_btn_quit_clicked()
{ {
// // 停止检测工作者线程
// for(int i = 0; i < 2; ++i)
// {
// g_recognitionRunning[i]->store(false);
// g_img_Queue[i]->stop(); // 停止队列以唤醒线程
// }
// // 等待检测工作者线程结束
// for(int i = 0; i < 2; ++i)
// {
// if(g_recognitionThread[i] && g_recognitionThread[i]->joinable())
// {
// g_recognitionThread[i]->join();
// delete g_recognitionThread[i];
// g_recognitionThread[i] = nullptr;
// }
// if(g_recognitionRunning[i])
// {
// delete g_recognitionRunning[i];
// g_recognitionRunning[i] = nullptr;
// }
// }
DestoryCamera();
DestoryLowMac();
qApp->quit(); qApp->quit();
} }
@ -480,11 +477,12 @@ void Widget::on_btn_set_lower_clicked()
file_valve = ui->spinbox_valve->text().toInt(); // 阀门通道 file_valve = ui->spinbox_valve->text().toInt(); // 阀门通道
} }
void Widget::update_machine_num() void Widget::update_main_settings()
{ {
ui->lab_machine_num->setText(QString("%1号机").arg(params["machine_num"])); ui->lab_machine_num->setText(QString("%1号机").arg(params["machine_num"]));
ui->spinbox_machine_code->setValue(params["machine_num"]); ui->spinbox_machine_code->setValue(params["machine_num"]);
ui->spinbox_maintime->setValue(params["lowmac_sm"]); ui->spinbox_maintime->setValue(params["lowmac_sm"]);
ui->spinbox_max_valves_together->setValue(params["max_valves_together"]);
} }
void Widget::on_btn_set_valve_clicked() void Widget::on_btn_set_valve_clicked()
@ -675,13 +673,13 @@ void Widget::initDefaultConfig()
{"blue_b_min", -48}, {"blue_b_max", -8}, {"blue_b_min", -48}, {"blue_b_max", -8},
// Orange // Orange
{"orange_L_min", 63}, {"orange_L_max", 78}, {"orange_L_min", 67}, {"orange_L_max", 93},
{"orange_a_min", 7}, {"orange_a_max", 14}, {"orange_a_min", -8}, {"orange_a_max", 8},
{"orange_b_min", 23}, {"orange_b_max", 47}, {"orange_b_min", 36}, {"orange_b_max", 58},
// Black // Black
{"black_L_min", 0}, {"black_L_max", 8}, {"black_L_min", 0}, {"black_L_max", 30},
{"black_a_min", -4}, {"black_a_max", 2}, {"black_a_min", -5}, {"black_a_max", 3},
{"black_b_min", -3}, {"black_b_max", 4}, {"black_b_min", -3}, {"black_b_max", 4},
// Red // Red
@ -690,8 +688,8 @@ void Widget::initDefaultConfig()
{"red_b_min", -80}, {"red_b_max", 37}, {"red_b_min", -80}, {"red_b_max", 37},
// Purple // Purple
{"purple_L_min", 38}, {"purple_L_max", 54}, {"purple_L_min", 38}, {"purple_L_max", 60},
{"purple_a_min", 10}, {"purple_a_max", 20}, {"purple_a_min", 10}, {"purple_a_max", 25},
{"purple_b_min", -45}, {"purple_b_max", 1}, {"purple_b_min", -45}, {"purple_b_max", 1},
// Yellow // Yellow
@ -888,8 +886,6 @@ void Widget::on_btn_del_color_clicked()
void Widget::on_btn_reset_color_clicked() void Widget::on_btn_reset_color_clicked()
{ {
// 新增全部还原槽
// 确认重置 // 确认重置
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "全部还原", "确定要将配置还原为默认设置吗?", reply = QMessageBox::question(this, "全部还原", "确定要将配置还原为默认设置吗?",
@ -1015,10 +1011,10 @@ void Widget::on_btn_reset_polar_clicked()
if (reply != QMessageBox::Yes) if (reply != QMessageBox::Yes)
return; return;
params["lowmac_td"]= 7; params["lowmac_td"]= 2;
params["lowmac_sg"]= 65; params["lowmac_sg"]= 60;
params["lowmac_dp"]= 350; params["lowmac_dp"]= 350;
params["lowmac_ts"]= 10; params["lowmac_ts"]= 13;
lowmac_dp = params["lowmac_dp"]; //偏振延迟时间 lowmac_dp = params["lowmac_dp"]; //偏振延迟时间
lowmac_ts = params["lowmac_ts"]; //模板匹配阈值 lowmac_ts = params["lowmac_ts"]; //模板匹配阈值
lowmac_sg = params["lowmac_sg"]; //偏振绿色通道大小阈值 lowmac_sg = params["lowmac_sg"]; //偏振绿色通道大小阈值
@ -1038,8 +1034,8 @@ void Widget::update_polar()
void Widget::on_tabWidget_currentChanged(int index) void Widget::on_tabWidget_currentChanged(int index)
{ {
update_machine_num(); update_main_settings();
update_colorlist(); // 更新色彩列表 update_colorlist(); // 更新色彩列表
update_polar(); // 更新偏振相机界面 update_polar(); // 更新偏振相机界面
} }

View File

@ -35,8 +35,6 @@ private slots:
void refreshSingleImage(int camera_id, bool overlay_traditional_result = false, bool overlay_dl_result = false, bool mirror = false); void refreshSingleImage(int camera_id, bool overlay_traditional_result = false, bool overlay_dl_result = false, bool mirror = false);
void on_pushButton_2_clicked();
void on_btn_stop_clicked(); void on_btn_stop_clicked();
void on_btn_start_clicked(); void on_btn_start_clicked();
@ -102,8 +100,8 @@ private slots:
void on_btn_reset_polar_clicked(); void on_btn_reset_polar_clicked();
void update_polar(); void update_polar();
void update_machine_num();
void update_main_settings();
void on_tabWidget_currentChanged(int index); void on_tabWidget_currentChanged(int index);
@ -112,10 +110,11 @@ private:
bool isCamRunning; bool isCamRunning;
QDateTime startTime; // 记录点“开始分选”的时间,用于计算总运行时长 QDateTime startTime; // 记录点“开始分选”的时间,用于计算总运行时长
QThread storageThread; // 存储线程 QThread storageThread; // 存储线程
StorageWorker* storageWorker; // 存储工作者
StorageWorker* storageWorker; // 存储工作者
void showStartupCountdown(); void showStartupCountdown();

View File

@ -47,7 +47,7 @@
<string notr="true">background-color: rgb(228, 223, 186);</string> <string notr="true">background-color: rgb(228, 223, 186);</string>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>1</number>
</property> </property>
<property name="tabBarAutoHide"> <property name="tabBarAutoHide">
<bool>true</bool> <bool>true</bool>
@ -416,7 +416,7 @@ QPushButton#btn_quit:disabled {
<string notr="true">font: 18pt &quot;Microsoft YaHei UI&quot;;</string> <string notr="true">font: 18pt &quot;Microsoft YaHei UI&quot;;</string>
</property> </property>
<property name="text"> <property name="text">
<string>相机1</string> <string>气罐侧-相机1</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -535,7 +535,7 @@ border: 4px solid black;
<string notr="true">font: 18pt &quot;Microsoft YaHei UI&quot;;</string> <string notr="true">font: 18pt &quot;Microsoft YaHei UI&quot;;</string>
</property> </property>
<property name="text"> <property name="text">
<string>相机0</string> <string>出风口侧-相机0</string>
</property> </property>
</widget> </widget>
</item> </item>