napoleon version for polarization camera

This commit is contained in:
XinJiang1 2024-12-28 19:00:19 +08:00
parent 100734144e
commit c967a2daec
10 changed files with 546 additions and 126 deletions

View File

@ -67,6 +67,13 @@ extern int file_delay;
extern int file_encoder; extern int file_encoder;
extern int file_valve; extern int file_valve;
//下位机参数
extern int lowmac_dp; //偏振延迟时间
extern int lowmac_sm; //吹气量
extern int lowmac_ts; //模板匹配阈值
extern int lowmac_sg; //偏振绿色通道大小阈值
extern int lowmac_td; //偏振红色通道差值
Timer CallBackTimer0; Timer CallBackTimer0;
Timer CallBackTimer1; Timer CallBackTimer1;
@ -126,12 +133,12 @@ bool iniCamera()
return 1; return 1;
} }
#if(GlobalDebug && DebugDetection) // #if(GlobalDebug && DebugDetection)
// #define SAVE_PATH_resize MIL_TEXT ("C:\\Users\\Pc\\Desktop\\cotton_double2//resize.png") // // #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_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_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") // #define SAVE_PATH_result MIL_TEXT ("C:\\Users\\Pc\\Desktop\\cotton_double2//result.png")
#endif // #endif
MIL_INT ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr) MIL_INT ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
{ {
@ -366,9 +373,9 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
// 将图像推入识别队列 // 将图像推入识别队列
cv::Mat img = ImageUtils::mil2Mat(MimResizedestination); cv::Mat img = ImageUtils::mil2Mat(MimResizedestination);
ImageData recognitionData; ImageData recognitionData;
recognitionData.camera_id = 1; recognitionData.camera_id = camera_id;
recognitionData.image = img; recognitionData.image = img;
g_img_Queue[1]->enqueue(recognitionData); g_img_Queue[camera_id]->enqueue(recognitionData);
} }
#if(GlobalDebug && DebugDetectionTime) #if(GlobalDebug && DebugDetectionTime)
@ -440,7 +447,7 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
if (future_dl.wait_for(std::chrono::milliseconds(20)) == std::future_status::ready && future_dl.get()) if (future_dl.wait_for(std::chrono::milliseconds(20)) == std::future_status::ready && future_dl.get())
{ {
#if(GlobalDebug && DebugDetectionTime) #if(GlobalDebug && DebugDetectionTime)
timer_detection_time.printElapsedTime("CallBack1: DL detection finished within 20ms"); timer_detection_time.printElapsedTime("CallBack2: DL detection finished within 20ms");
timer_detection_time.restart(); timer_detection_time.restart();
#endif #endif
// 将深度学习的检测结果转换为 OpenCV Mat // 将深度学习的检测结果转换为 OpenCV Mat
@ -454,7 +461,7 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
dl_mask = matrox_mask; dl_mask = matrox_mask;
merged_mask = matrox_mask; merged_mask = matrox_mask;
#if(GlobalDebug && DebugDetectionTime) #if(GlobalDebug && DebugDetectionTime)
timer_detection_time.printElapsedTime("CallBack1: DL detection error or timeout to mask"); timer_detection_time.printElapsedTime("CallBack2: DL detection error or timeout to mask");
timer_detection_time.restart(); timer_detection_time.restart();
#endif #endif
} }
@ -474,7 +481,7 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
#endif #endif
mask_1 = merged_mask; mask_1 = merged_mask;
#if(GlobalDebug && DebugDetection) #if(GlobalDebug && DebufgDetection)
MbufSave(SAVE_PATH_flip,MimFlipDedtination); MbufSave(SAVE_PATH_flip,MimFlipDedtination);
// MbufSave(SAVE_PATH_resize,MimResizedestination); // MbufSave(SAVE_PATH_resize,MimResizedestination);
MbufSave(SAVE_PATH_raw,MilImage_Color0); MbufSave(SAVE_PATH_raw,MilImage_Color0);
@ -484,23 +491,88 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
detection_ready.acquire(); detection_ready.acquire();
vector<vector<uint8_t>> mask_tail; vector<vector<uint8_t>> mask_tail;
merged_mask = ImageUtils::mergeMasks(mask_0, mask_1, dual_cam_offset_y); merged_mask = ImageUtils::mergeMasks(mask_0, mask_1, dual_cam_offset_y);
std::tie(merged_mask, mask_tail) = ImageUtils::extractROI(merged_mask, 0, 0, widthBlocks, heightBlocks); std::tie(merged_mask, mask_tail) = ImageUtils::extractROI(merged_mask, 0, 0, widthBlocks, heightBlocks);
#if(GlobalDebug && DebugDetection)
int row_count = 0;
std::cout << "<<<<<<<<<<<<<<<<<<<<<Mask_0<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
for(auto row: mask_0)
{ std::cout << row_count << " ";
for (auto element: row)
{
std::cout << int(element) << " ";
}
std::cout << std::endl;
row_count ++;
if(row_count >3)
break;
}
std::cout << ">>>>>>>>>>>>>>>>>>>>Mask_0>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std:: endl;
row_count = 0;
std::cout << "<<<<<<<<<<<<<<<<<<<<<Mask_1<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
for(auto row: mask_1)
{ std::cout << row_count << " ";
for (auto element: row)
{
std::cout << int(element) << " ";
}
std::cout << std::endl;
row_count ++;
if(row_count >3)
break;
}
std::cout << ">>>>>>>>>>>>>>>>>>>>Mask_1>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std:: endl;
row_count = 0;
std::cout << "<<<<<<<<<<<<<<<<<<<<<merged_mask<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
for(auto row: merged_mask)
{ std::cout << row_count << " ";
for (auto element: row)
{
std::cout << int(element) << " ";
}
std::cout << std::endl;
row_count ++;
if(row_count >3)
break;
}
std::cout << ">>>>>>>>>>>>>>>>>>>>merged_mask>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std:: endl;
#endif
// 结果后处理Post Process // 结果后处理Post Process
// 将每个结果左右扩展扩展半径默认为1 // 将每个结果左右扩展扩展半径默认为1
auto mask_expaned = expandMaskHorizontally(merged_mask, expansionRaidus); auto mask_expaned = expandMaskHorizontally(merged_mask, expansionRaidus);
// 将结果的左右补充上0让物体大小符合要求 // 将结果的左右补充上0让物体大小符合要求
PadColumns(mask_expaned, padLeft, padRight, 0); PadColumns(mask_expaned, padLeft, padRight, 0);
// ======= 新增:统计 mask_expaned 里的 1 的总个数,并累加到全局变量 =======
{
long long count_ones_this_time = 0;
for(const auto & row : mask_expaned)
{
for(uint8_t val : row)
{
count_ones_this_time += (val == 1);
}
}
g_valveActionCount += count_ones_this_time;
// 如果你想调试打印,可以
// qDebug() << "This callback1 new triggered bits =" << count_ones_this_time
// << ", total=" << g_valveActionCount;
}
// ======= 新增结束 =======
//将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 // save masks
#if(GlobalDebug && DebugDetection) // #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" + std::to_string(FuncCount1) + ".bmp");
VectorToImg(mask_1,"C:/Users/Pc/Desktop/img/mask_ignored" + 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"); // VectorToImg(mask_Total,"C:/Users/Pc/Desktop/img/mask_expended" + std::to_string(FuncCount1) + ".bmp");
#endif // #endif
// 发送到下位机 // 发送到下位机
bool result_Low = get_valve_data(mask_Total); bool result_Low = get_valve_data(mask_Total);
if(!result_Low) if(!result_Low)
@ -559,7 +631,7 @@ void lab_process_raw(const MIL_ID& inputImage, MIL_ID& outputImageLab, const std
} }
// Inquire image properties once // Inquire image properties once
MIL_ID MilSystem = MbufInquire(inputImage, M_OWNER_SYSTEM, M_NULL); // MIL_ID MilSystem = MbufInquire(inputImage, M_OWNER_SYSTEM, M_NULL);
MIL_INT SizeX = MbufInquire(inputImage, M_SIZE_X, M_NULL); MIL_INT SizeX = MbufInquire(inputImage, M_SIZE_X, M_NULL);
MIL_INT SizeY = MbufInquire(inputImage, M_SIZE_Y, M_NULL); MIL_INT SizeY = MbufInquire(inputImage, M_SIZE_Y, M_NULL);
@ -650,7 +722,7 @@ void lab_process_raw(const MIL_ID& inputImage, MIL_ID& outputImageLab, const std
void lab_process(const MIL_ID& inputImage, MIL_ID& outputImageLab, const std::map<std::string, int>& params) { void lab_process(const MIL_ID& inputImage, MIL_ID& outputImageLab, const std::map<std::string, int>& params) {
const std::vector<std::string> colors = {"green", "blue", "orange", "black", "red", "purple", "yellow"}; const std::vector<std::string> colors = {"green", "blue", "orange", "black", "red", "purple"};
lab_process_raw(inputImage, outputImageLab, params, colors); lab_process_raw(inputImage, outputImageLab, params, colors);
} }
@ -967,10 +1039,6 @@ bool iniLowMac()
QString divide_parameter = QString("%1").arg(divide_camera, 8, 10, QChar('0')); QString divide_parameter = QString("%1").arg(divide_camera, 8, 10, QChar('0'));
QString sv_parameter = QString("%1").arg(divide_valve, 8, 10, QChar('0')); QString sv_parameter = QString("%1").arg(divide_valve, 8, 10, QChar('0'));
// QString delay_time = QString("%1").arg(file_delay, 0, 16); // 去掉补0的部分
// QString divide_parameter = QString("%1").arg(file_encoder, 0, 16);
// QString sv_parameter = QString("%1").arg(file_valve, 0, 16);
int len_delay = delay_time.size(); int len_delay = delay_time.size();
int len_divide = divide_parameter.size(); int len_divide = divide_parameter.size();
int len_sv = sv_parameter.size(); int len_sv = sv_parameter.size();
@ -1040,6 +1108,121 @@ bool iniLowMac()
delete[] valve_divide_buf; delete[] valve_divide_buf;
// //下位机参数
// int lowmac_dp = 400; //偏振延迟时间
// int lowmac_sm = 5; //吹气量
// int lowmac_ts = 15; //模板匹配阈值
// int lowmac_sg = 80; //偏振绿色通道大小阈值
// int lowmac_td = 10; //偏振红色通道差值
//新增下位机协议
// 将参数转换为长度为8的字符串前面补0
QString dp = QString("%1").arg(lowmac_dp, 8, 10, QChar('0'));
QString sm = QString("%1").arg(lowmac_sm, 8, 10, QChar('0'));
QString ts = QString("%1").arg(lowmac_ts, 8, 10, QChar('0'));
QString sg = QString("%1").arg(lowmac_sg, 8, 10, QChar('0'));
QString td = QString("%1").arg(lowmac_td, 8, 10, QChar('0'));
int len_dp = dp.size();
int len_sm = sm.size();
int len_ts = ts.size();
int len_sg = sg.size();
int len_td = td.size();
QByteArray dp_byte = dp.toLatin1();
QByteArray sm_byte = sm.toLatin1();
QByteArray ts_byte = ts.toLatin1();
QByteArray sg_byte = sg.toLatin1();
QByteArray td_byte = td.toLatin1();
uint8_t* dp_buf = new uint8_t[len_dp + 8];
dp_buf[0] = 0xAA;
dp_buf[1] = 0x00;
dp_buf[2] = len_dp + 2;
dp_buf[3] = 'd';
dp_buf[4] = 'p';
memcpy(dp_buf + 5, dp_byte.data(), len_dp);
dp_buf[len_dp + 5] = 0xFF;
dp_buf[len_dp + 6] = 0xFF;
dp_buf[len_dp + 7] = 0xBB;
if (lower_machine->isWritable()) {
lower_machine->write((const char*)dp_buf, len_dp + 8);
} else {
cout << "Error: Unable to write to lower machine for dp parameter." << endl;
}
delete[] dp_buf;
uint8_t* sm_buf = new uint8_t[len_sm + 8];
sm_buf[0] = 0xAA;
sm_buf[1] = 0x00;
sm_buf[2] = len_sm + 2;
sm_buf[3] = 's';
sm_buf[4] = 'm';
memcpy(sm_buf + 5, sm_byte.data(), len_sm);
sm_buf[len_sm + 5] = 0xFF;
sm_buf[len_sm + 6] = 0xFF;
sm_buf[len_sm + 7] = 0xBB;
if (lower_machine->isWritable()) {
lower_machine->write((const char*)sm_buf, len_sm + 8);
} else {
cout << "Error: Unable to write to lower machine for sm parameter." << endl;
}
delete[] sm_buf;
uint8_t* ts_buf = new uint8_t[len_ts + 8];
ts_buf[0] = 0xAA;
ts_buf[1] = 0x00;
ts_buf[2] = len_ts + 2;
ts_buf[3] = 't';
ts_buf[4] = 's';
memcpy(ts_buf + 5, ts_byte.data(), len_ts);
ts_buf[len_ts + 5] = 0xFF;
ts_buf[len_ts + 6] = 0xFF;
ts_buf[len_ts + 7] = 0xBB;
if (lower_machine->isWritable()) {
lower_machine->write((const char*)ts_buf, len_ts + 8);
} else {
cout << "Error: Unable to write to lower machine for ts parameter." << endl;
}
delete[] ts_buf;
uint8_t* sg_buf = new uint8_t[len_sg + 8];
sg_buf[0] = 0xAA;
sg_buf[1] = 0x00;
sg_buf[2] = len_sg + 2;
sg_buf[3] = 's';
sg_buf[4] = 'g';
memcpy(sg_buf + 5, sg_byte.data(), len_sg);
sg_buf[len_sg + 5] = 0xFF;
sg_buf[len_sg + 6] = 0xFF;
sg_buf[len_sg + 7] = 0xBB;
if (lower_machine->isWritable()) {
lower_machine->write((const char*)sg_buf, len_sg + 8);
} else {
cout << "Error: Unable to write to lower machine for sg parameter." << endl;
}
delete[] sg_buf;
uint8_t* td_buf = new uint8_t[len_td + 8];
td_buf[0] = 0xAA;
td_buf[1] = 0x00;
td_buf[2] = len_td + 2;
td_buf[3] = 't';
td_buf[4] = 'd';
memcpy(td_buf + 5, td_byte.data(), len_td);
td_buf[len_td + 5] = 0xFF;
td_buf[len_td + 6] = 0xFF;
td_buf[len_td + 7] = 0xBB;
if (lower_machine->isWritable()) {
lower_machine->write((const char*)td_buf, len_td + 8);
} else {
cout << "Error: Unable to write to lower machine for td parameter." << endl;
}
delete[] td_buf;
return 1; return 1;
} }

View File

@ -46,15 +46,6 @@ purple_a_max = 22
purple_b_min = -48 purple_b_min = -48
purple_b_max = 1 purple_b_max = 1
# yellow color parameters
yellow_L_min = 45
yellow_L_max = 56
yellow_a_min = -4
yellow_a_max = 7
yellow_b_min = 20
yellow_b_max = 21
# Other parameters # Other parameters
lab_denoising = 1 lab_denoising = 1
saturation_threshold = 155 saturation_threshold = 155

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 15.0.0, 2024-12-28T00:29:22. --> <!-- Written by QtCreator 15.0.0, 2024-12-28T13:38:02. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -1,6 +1,9 @@
// globals.cpp // globals.cpp
#include "globals.h" #include "globals.h"
// camera.cpp 顶部或 globals.cpp 中
long long g_valveActionCount = 0;
// 初始化图片显示互斥锁和MIL_ID // 初始化图片显示互斥锁和MIL_ID
QMutex gDispPicMutex0; QMutex gDispPicMutex0;
MIL_ID gDispCurrentPicId0 = 0; MIL_ID gDispCurrentPicId0 = 0;

View File

@ -16,6 +16,8 @@
#include <atomic> #include <atomic>
#include "onnxrunner.h" #include "onnxrunner.h"
extern long long g_valveActionCount;
// 图片显示0 // 图片显示0
extern QMutex gDispPicMutex0; extern QMutex gDispPicMutex0;
extern MIL_ID gDispCurrentPicId0; extern MIL_ID gDispCurrentPicId0;

View File

@ -46,15 +46,6 @@ purple_a_max = 22
purple_b_min = -48 purple_b_min = -48
purple_b_max = 1 purple_b_max = 1
# yellow color parameters
yellow_L_min = 45
yellow_L_max = 56
yellow_a_min = -4
yellow_a_max = 7
yellow_b_min = 20
yellow_b_max = 21
# Other parameters # Other parameters
lab_denoising = 1 lab_denoising = 1
saturation_threshold = 155 saturation_threshold = 155

View File

@ -12,10 +12,14 @@
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
#include <QtWidgets/QCheckBox> #include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QFrame> #include <QtWidgets/QFrame>
#include <QtWidgets/QGroupBox> #include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout> #include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel> #include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QListView>
#include <QtWidgets/QListWidget>
#include <QtWidgets/QProgressBar> #include <QtWidgets/QProgressBar>
#include <QtWidgets/QPushButton> #include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem> #include <QtWidgets/QSpacerItem>
@ -98,7 +102,7 @@ public:
QHBoxLayout *horizontalLayout_2; QHBoxLayout *horizontalLayout_2;
QLabel *label_5; QLabel *label_5;
QSpacerItem *horizontalSpacer_3; QSpacerItem *horizontalSpacer_3;
QLabel *label_6; QLabel *label_currentDateTime;
QSpacerItem *horizontalSpacer_4; QSpacerItem *horizontalSpacer_4;
QPushButton *btn_settings; QPushButton *btn_settings;
QPushButton *btn_live; QPushButton *btn_live;
@ -111,13 +115,13 @@ public:
QSpacerItem *horizontalSpacer_5; QSpacerItem *horizontalSpacer_5;
QSpacerItem *verticalSpacer_3; QSpacerItem *verticalSpacer_3;
QHBoxLayout *horizontalLayout_8; QHBoxLayout *horizontalLayout_8;
QLabel *label_10; QLabel *label_totalHours;
QLabel *label_8; QLabel *label_hourUnit;
QLabel *label_11; QLabel *label_totalMinutes;
QLabel *label_9; QLabel *label_minuteUnit;
QSpacerItem *verticalSpacer_2; QSpacerItem *verticalSpacer_2;
QHBoxLayout *horizontalLayout_9; QHBoxLayout *horizontalLayout_9;
QLabel *label_12; QLabel *label_todayRunningTime;
QSpacerItem *horizontalSpacer_6; QSpacerItem *horizontalSpacer_6;
QProgressBar *progressBar; QProgressBar *progressBar;
QFrame *frame_valve; QFrame *frame_valve;
@ -127,7 +131,7 @@ public:
QSpacerItem *horizontalSpacer_7; QSpacerItem *horizontalSpacer_7;
QSpacerItem *verticalSpacer_4; QSpacerItem *verticalSpacer_4;
QHBoxLayout *horizontalLayout_11; QHBoxLayout *horizontalLayout_11;
QLabel *label_16; QLabel *label_valve_actions;
QLabel *label_17; QLabel *label_17;
QSpacerItem *verticalSpacer_5; QSpacerItem *verticalSpacer_5;
QHBoxLayout *horizontalLayout_17; QHBoxLayout *horizontalLayout_17;
@ -150,6 +154,18 @@ public:
QLabel *label_20; QLabel *label_20;
QLabel *label_21; QLabel *label_21;
QSpacerItem *horizontalSpacer_12; QSpacerItem *horizontalSpacer_12;
QWidget *tab_5;
QLineEdit *lineEdit_search;
QLabel *label_6;
QComboBox *comboBox_dateFilter;
QLabel *label_8;
QListWidget *listWidget_dateTimeline;
QListView *listView_thumbnails;
QLabel *label_imagePreview;
QLabel *label_captureTime;
QCheckBox *checkBox_dl;
QCheckBox *checkBox_matrox;
QSpinBox *spinBox_pagination;
void setupUi(QWidget *Widget) void setupUi(QWidget *Widget)
{ {
@ -416,7 +432,9 @@ public:
dl_enable_1 = new QCheckBox(frame); dl_enable_1 = new QCheckBox(frame);
dl_enable_1->setObjectName("dl_enable_1"); dl_enable_1->setObjectName("dl_enable_1");
dl_enable_1->setEnabled(false);
dl_enable_1->setStyleSheet(QString::fromUtf8("font: 12pt \"Microsoft YaHei UI\";")); dl_enable_1->setStyleSheet(QString::fromUtf8("font: 12pt \"Microsoft YaHei UI\";"));
dl_enable_1->setChecked(true);
horizontalLayout_4->addWidget(dl_enable_1); horizontalLayout_4->addWidget(dl_enable_1);
@ -482,7 +500,9 @@ public:
dl_enable_0 = new QCheckBox(frame_2); dl_enable_0 = new QCheckBox(frame_2);
dl_enable_0->setObjectName("dl_enable_0"); dl_enable_0->setObjectName("dl_enable_0");
dl_enable_0->setEnabled(false);
dl_enable_0->setStyleSheet(QString::fromUtf8("font: 12pt \"Microsoft YaHei UI\";")); dl_enable_0->setStyleSheet(QString::fromUtf8("font: 12pt \"Microsoft YaHei UI\";"));
dl_enable_0->setChecked(true);
horizontalLayout_5->addWidget(dl_enable_0); horizontalLayout_5->addWidget(dl_enable_0);
@ -674,12 +694,12 @@ public:
horizontalLayout_2->addItem(horizontalSpacer_3); horizontalLayout_2->addItem(horizontalSpacer_3);
label_6 = new QLabel(frame_4); label_currentDateTime = new QLabel(frame_4);
label_6->setObjectName("label_6"); label_currentDateTime->setObjectName("label_currentDateTime");
label_6->setStyleSheet(QString::fromUtf8("font: 14pt \"Microsoft YaHei UI\";\n" label_currentDateTime->setStyleSheet(QString::fromUtf8("font: 14pt \"Microsoft YaHei UI\";\n"
"color: rgb(170, 170, 170)")); "color: rgb(170, 170, 170)"));
horizontalLayout_2->addWidget(label_6); horizontalLayout_2->addWidget(label_currentDateTime);
horizontalSpacer_4 = new QSpacerItem(672, 20, QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Minimum); horizontalSpacer_4 = new QSpacerItem(672, 20, QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Minimum);
@ -790,7 +810,7 @@ public:
"border-radius: 12px;\n" "border-radius: 12px;\n"
"padding: 20px;\n" "padding: 20px;\n"
"min-width: 300px;\n" "min-width: 300px;\n"
"box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.5);}")); "}"));
frame_running_time->setFrameShape(QFrame::Shape::StyledPanel); frame_running_time->setFrameShape(QFrame::Shape::StyledPanel);
frame_running_time->setFrameShadow(QFrame::Shadow::Raised); frame_running_time->setFrameShadow(QFrame::Shadow::Raised);
verticalLayout_2 = new QVBoxLayout(frame_running_time); verticalLayout_2 = new QVBoxLayout(frame_running_time);
@ -820,48 +840,48 @@ public:
horizontalLayout_8 = new QHBoxLayout(); horizontalLayout_8 = new QHBoxLayout();
horizontalLayout_8->setObjectName("horizontalLayout_8"); horizontalLayout_8->setObjectName("horizontalLayout_8");
horizontalLayout_8->setSizeConstraint(QLayout::SizeConstraint::SetMinimumSize); horizontalLayout_8->setSizeConstraint(QLayout::SizeConstraint::SetMinimumSize);
label_10 = new QLabel(frame_running_time); label_totalHours = new QLabel(frame_running_time);
label_10->setObjectName("label_10"); label_totalHours->setObjectName("label_totalHours");
label_10->setStyleSheet(QString::fromUtf8("font: 700 32pt \"Microsoft YaHei UI\";\n" label_totalHours->setStyleSheet(QString::fromUtf8("font: 700 32pt \"Microsoft YaHei UI\";\n"
"color:rgb(105,186,210);\n" "color:rgb(105,186,210);\n"
"background-color: #2d2d2d;;\n" "background-color: #2d2d2d;;\n"
"")); ""));
horizontalLayout_8->addWidget(label_10); horizontalLayout_8->addWidget(label_totalHours);
label_8 = new QLabel(frame_running_time); label_hourUnit = new QLabel(frame_running_time);
label_8->setObjectName("label_8"); label_hourUnit->setObjectName("label_hourUnit");
QSizePolicy sizePolicy4(QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Minimum); QSizePolicy sizePolicy4(QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Minimum);
sizePolicy4.setHorizontalStretch(0); sizePolicy4.setHorizontalStretch(0);
sizePolicy4.setVerticalStretch(0); sizePolicy4.setVerticalStretch(0);
sizePolicy4.setHeightForWidth(label_8->sizePolicy().hasHeightForWidth()); sizePolicy4.setHeightForWidth(label_hourUnit->sizePolicy().hasHeightForWidth());
label_8->setSizePolicy(sizePolicy4); label_hourUnit->setSizePolicy(sizePolicy4);
label_8->setStyleSheet(QString::fromUtf8("font: 700 20pt \"Microsoft YaHei UI\";\n" label_hourUnit->setStyleSheet(QString::fromUtf8("font: 700 20pt \"Microsoft YaHei UI\";\n"
"color:rgb(105,186,210);\n" "color:rgb(105,186,210);\n"
"background-color: #2d2d2d;;\n" "background-color: #2d2d2d;;\n"
"")); ""));
horizontalLayout_8->addWidget(label_8); horizontalLayout_8->addWidget(label_hourUnit);
label_11 = new QLabel(frame_running_time); label_totalMinutes = new QLabel(frame_running_time);
label_11->setObjectName("label_11"); label_totalMinutes->setObjectName("label_totalMinutes");
label_11->setStyleSheet(QString::fromUtf8("font: 700 32pt \"Microsoft YaHei UI\";\n" label_totalMinutes->setStyleSheet(QString::fromUtf8("font: 700 32pt \"Microsoft YaHei UI\";\n"
"color:rgb(105,186,210);\n" "color:rgb(105,186,210);\n"
"background-color: #2d2d2d;;\n" "background-color: #2d2d2d;;\n"
"")); ""));
horizontalLayout_8->addWidget(label_11); horizontalLayout_8->addWidget(label_totalMinutes);
label_9 = new QLabel(frame_running_time); label_minuteUnit = new QLabel(frame_running_time);
label_9->setObjectName("label_9"); label_minuteUnit->setObjectName("label_minuteUnit");
sizePolicy4.setHeightForWidth(label_9->sizePolicy().hasHeightForWidth()); sizePolicy4.setHeightForWidth(label_minuteUnit->sizePolicy().hasHeightForWidth());
label_9->setSizePolicy(sizePolicy4); label_minuteUnit->setSizePolicy(sizePolicy4);
label_9->setStyleSheet(QString::fromUtf8("font: 700 20pt \"Microsoft YaHei UI\";\n" label_minuteUnit->setStyleSheet(QString::fromUtf8("font: 700 20pt \"Microsoft YaHei UI\";\n"
"color:rgb(105,186,210);\n" "color:rgb(105,186,210);\n"
"background-color: #2d2d2d;;\n" "background-color: #2d2d2d;;\n"
"")); ""));
horizontalLayout_8->addWidget(label_9); horizontalLayout_8->addWidget(label_minuteUnit);
verticalLayout_2->addLayout(horizontalLayout_8); verticalLayout_2->addLayout(horizontalLayout_8);
@ -872,14 +892,14 @@ public:
horizontalLayout_9 = new QHBoxLayout(); horizontalLayout_9 = new QHBoxLayout();
horizontalLayout_9->setObjectName("horizontalLayout_9"); horizontalLayout_9->setObjectName("horizontalLayout_9");
label_12 = new QLabel(frame_running_time); label_todayRunningTime = new QLabel(frame_running_time);
label_12->setObjectName("label_12"); label_todayRunningTime->setObjectName("label_todayRunningTime");
label_12->setStyleSheet(QString::fromUtf8("font: 700 14pt \"Microsoft YaHei UI\";\n" label_todayRunningTime->setStyleSheet(QString::fromUtf8("font: 700 14pt \"Microsoft YaHei UI\";\n"
"color:rgb(169,169,169);\n" "color:rgb(169,169,169);\n"
"background-color: #2d2d2d;;\n" "background-color: #2d2d2d;;\n"
"")); ""));
horizontalLayout_9->addWidget(label_12); horizontalLayout_9->addWidget(label_todayRunningTime);
horizontalSpacer_6 = new QSpacerItem(40, 20, QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Minimum); horizontalSpacer_6 = new QSpacerItem(40, 20, QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Minimum);
@ -938,7 +958,7 @@ public:
"border-radius: 12px;\n" "border-radius: 12px;\n"
"padding: 20px;\n" "padding: 20px;\n"
"min-width: 300px;\n" "min-width: 300px;\n"
"box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.5);}")); "}"));
frame_valve->setFrameShape(QFrame::Shape::StyledPanel); frame_valve->setFrameShape(QFrame::Shape::StyledPanel);
frame_valve->setFrameShadow(QFrame::Shadow::Raised); frame_valve->setFrameShadow(QFrame::Shadow::Raised);
verticalLayout_6 = new QVBoxLayout(frame_valve); verticalLayout_6 = new QVBoxLayout(frame_valve);
@ -967,15 +987,15 @@ public:
horizontalLayout_11 = new QHBoxLayout(); horizontalLayout_11 = new QHBoxLayout();
horizontalLayout_11->setObjectName("horizontalLayout_11"); horizontalLayout_11->setObjectName("horizontalLayout_11");
label_16 = new QLabel(frame_valve); label_valve_actions = new QLabel(frame_valve);
label_16->setObjectName("label_16"); label_valve_actions->setObjectName("label_valve_actions");
label_16->setStyleSheet(QString::fromUtf8("font: 700 32pt \"Microsoft YaHei UI\";\n" label_valve_actions->setStyleSheet(QString::fromUtf8("font: 700 32pt \"Microsoft YaHei UI\";\n"
"color:rgb(105,186,210);\n" "color:rgb(105,186,210);\n"
"background-color: #2d2d2d;;\n" "background-color: #2d2d2d;;\n"
"")); ""));
label_16->setAlignment(Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter); label_valve_actions->setAlignment(Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter);
horizontalLayout_11->addWidget(label_16); horizontalLayout_11->addWidget(label_valve_actions);
label_17 = new QLabel(frame_valve); label_17 = new QLabel(frame_valve);
label_17->setObjectName("label_17"); label_17->setObjectName("label_17");
@ -1048,7 +1068,7 @@ public:
"border-radius: 12px;\n" "border-radius: 12px;\n"
"padding: 20px;\n" "padding: 20px;\n"
"min-width: 300px;\n" "min-width: 300px;\n"
"box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.5);}")); "}"));
frame_history->setFrameShape(QFrame::Shape::StyledPanel); frame_history->setFrameShape(QFrame::Shape::StyledPanel);
frame_history->setFrameShadow(QFrame::Shadow::Raised); frame_history->setFrameShadow(QFrame::Shadow::Raised);
verticalLayout_7 = new QVBoxLayout(frame_history); verticalLayout_7 = new QVBoxLayout(frame_history);
@ -1127,13 +1147,49 @@ public:
verticalLayout_8->addWidget(frame_8); verticalLayout_8->addWidget(frame_8);
tabWidget->addTab(tab_4, QString()); tabWidget->addTab(tab_4, QString());
tab_5 = new QWidget();
tab_5->setObjectName("tab_5");
lineEdit_search = new QLineEdit(tab_5);
lineEdit_search->setObjectName("lineEdit_search");
lineEdit_search->setGeometry(QRect(180, 80, 301, 51));
label_6 = new QLabel(tab_5);
label_6->setObjectName("label_6");
label_6->setGeometry(QRect(80, 80, 91, 61));
comboBox_dateFilter = new QComboBox(tab_5);
comboBox_dateFilter->setObjectName("comboBox_dateFilter");
comboBox_dateFilter->setGeometry(QRect(600, 100, 69, 22));
label_8 = new QLabel(tab_5);
label_8->setObjectName("label_8");
label_8->setGeometry(QRect(550, 100, 53, 15));
listWidget_dateTimeline = new QListWidget(tab_5);
listWidget_dateTimeline->setObjectName("listWidget_dateTimeline");
listWidget_dateTimeline->setGeometry(QRect(40, 220, 241, 681));
listView_thumbnails = new QListView(tab_5);
listView_thumbnails->setObjectName("listView_thumbnails");
listView_thumbnails->setGeometry(QRect(310, 220, 621, 681));
label_imagePreview = new QLabel(tab_5);
label_imagePreview->setObjectName("label_imagePreview");
label_imagePreview->setGeometry(QRect(970, 220, 841, 521));
label_captureTime = new QLabel(tab_5);
label_captureTime->setObjectName("label_captureTime");
label_captureTime->setGeometry(QRect(1030, 800, 211, 41));
checkBox_dl = new QCheckBox(tab_5);
checkBox_dl->setObjectName("checkBox_dl");
checkBox_dl->setGeometry(QRect(1310, 790, 111, 51));
checkBox_matrox = new QCheckBox(tab_5);
checkBox_matrox->setObjectName("checkBox_matrox");
checkBox_matrox->setGeometry(QRect(1540, 790, 211, 61));
spinBox_pagination = new QSpinBox(tab_5);
spinBox_pagination->setObjectName("spinBox_pagination");
spinBox_pagination->setGeometry(QRect(490, 930, 42, 22));
tabWidget->addTab(tab_5, QString());
horizontalLayout->addWidget(tabWidget); horizontalLayout->addWidget(tabWidget);
retranslateUi(Widget); retranslateUi(Widget);
tabWidget->setCurrentIndex(2); tabWidget->setCurrentIndex(1);
QMetaObject::connectSlotsByName(Widget); QMetaObject::connectSlotsByName(Widget);
@ -1184,17 +1240,17 @@ public:
btn_tab3_backtab2_2->setText(QCoreApplication::translate("Widget", "home", nullptr)); btn_tab3_backtab2_2->setText(QCoreApplication::translate("Widget", "home", nullptr));
tabWidget->setTabText(tabWidget->indexOf(tab_3), QCoreApplication::translate("Widget", "Tab 3", nullptr)); tabWidget->setTabText(tabWidget->indexOf(tab_3), QCoreApplication::translate("Widget", "Tab 3", nullptr));
label_5->setText(QCoreApplication::translate("Widget", "\351\223\266\345\212\233\346\243\211\346\262\271\346\234\272\346\242\260\346\234\211\351\231\220\345\205\254\345\217\270", nullptr)); label_5->setText(QCoreApplication::translate("Widget", "\351\223\266\345\212\233\346\243\211\346\262\271\346\234\272\346\242\260\346\234\211\351\231\220\345\205\254\345\217\270", nullptr));
label_6->setText(QCoreApplication::translate("Widget", "2024-12-26 10:30AM", nullptr)); label_currentDateTime->setText(QCoreApplication::translate("Widget", "2024-12-26 10:30AM", nullptr));
btn_settings->setText(QCoreApplication::translate("Widget", "\350\256\276\347\275\256", nullptr)); btn_settings->setText(QCoreApplication::translate("Widget", "\350\256\276\347\275\256", nullptr));
btn_live->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\272", nullptr)); btn_live->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\272", nullptr));
label_7->setText(QCoreApplication::translate("Widget", "\350\277\220\350\241\214\346\227\266\351\227\264", nullptr)); label_7->setText(QCoreApplication::translate("Widget", "\350\277\220\350\241\214\346\227\266\351\227\264", nullptr));
label_10->setText(QCoreApplication::translate("Widget", "482", nullptr)); label_totalHours->setText(QCoreApplication::translate("Widget", "482", nullptr));
label_8->setText(QCoreApplication::translate("Widget", "\345\260\217\346\227\266", nullptr)); label_hourUnit->setText(QCoreApplication::translate("Widget", "\345\260\217\346\227\266", nullptr));
label_11->setText(QCoreApplication::translate("Widget", "52", nullptr)); label_totalMinutes->setText(QCoreApplication::translate("Widget", "52", nullptr));
label_9->setText(QCoreApplication::translate("Widget", "\345\210\206\351\222\237", nullptr)); label_minuteUnit->setText(QCoreApplication::translate("Widget", "\345\210\206\351\222\237", nullptr));
label_12->setText(QCoreApplication::translate("Widget", "\344\273\212\346\227\245\350\277\220\350\241\214\346\227\266\351\225\277:8\345\260\217\346\227\26615\345\210\206\351\222\23732\347\247\222", nullptr)); label_todayRunningTime->setText(QCoreApplication::translate("Widget", "\344\273\212\346\227\245\350\277\220\350\241\214\346\227\266\351\225\277:8\345\260\217\346\227\26615\345\210\206\351\222\23732\347\247\222", nullptr));
label_13->setText(QCoreApplication::translate("Widget", "\345\226\267\346\260\224\346\254\241\346\225\260", nullptr)); label_13->setText(QCoreApplication::translate("Widget", "\345\226\267\346\260\224\346\254\241\346\225\260", nullptr));
label_16->setText(QCoreApplication::translate("Widget", "12,233,473", nullptr)); label_valve_actions->setText(QCoreApplication::translate("Widget", "12,233,473", nullptr));
label_17->setText(QCoreApplication::translate("Widget", "\346\254\241", nullptr)); label_17->setText(QCoreApplication::translate("Widget", "\346\254\241", nullptr));
label_19->setText(QCoreApplication::translate("Widget", "\344\273\212\346\227\245\347\264\257\350\256\241\345\226\267\346\260\224\346\254\241\346\225\260:", nullptr)); label_19->setText(QCoreApplication::translate("Widget", "\344\273\212\346\227\245\347\264\257\350\256\241\345\226\267\346\260\224\346\254\241\346\225\260:", nullptr));
label_18->setText(QCoreApplication::translate("Widget", "320\346\254\241", nullptr)); label_18->setText(QCoreApplication::translate("Widget", "320\346\254\241", nullptr));
@ -1202,6 +1258,13 @@ public:
label_20->setText(QCoreApplication::translate("Widget", "\350\256\276\345\244\207\347\212\266\346\200\201: ", nullptr)); label_20->setText(QCoreApplication::translate("Widget", "\350\256\276\345\244\207\347\212\266\346\200\201: ", nullptr));
label_21->setText(QCoreApplication::translate("Widget", "\346\255\243\345\270\270\350\277\220\350\241\214", nullptr)); label_21->setText(QCoreApplication::translate("Widget", "\346\255\243\345\270\270\350\277\220\350\241\214", nullptr));
tabWidget->setTabText(tabWidget->indexOf(tab_4), QCoreApplication::translate("Widget", "Tab 4", nullptr)); tabWidget->setTabText(tabWidget->indexOf(tab_4), QCoreApplication::translate("Widget", "Tab 4", nullptr));
label_6->setText(QCoreApplication::translate("Widget", "search", nullptr));
label_8->setText(QCoreApplication::translate("Widget", "date", nullptr));
label_imagePreview->setText(QCoreApplication::translate("Widget", "TextLabel", nullptr));
label_captureTime->setText(QCoreApplication::translate("Widget", "TextLabel", nullptr));
checkBox_dl->setText(QCoreApplication::translate("Widget", "DL", nullptr));
checkBox_matrox->setText(QCoreApplication::translate("Widget", "traditional", nullptr));
tabWidget->setTabText(tabWidget->indexOf(tab_5), QCoreApplication::translate("Widget", "\351\241\265", nullptr));
} // retranslateUi } // retranslateUi
}; };

View File

@ -24,6 +24,12 @@ int file_delay = 1200; // 延迟时间(毫秒)
int file_encoder = 12000; // 行频 int file_encoder = 12000; // 行频
int file_valve = 200; // 喷阀触发频率 int file_valve = 200; // 喷阀触发频率
//下位机参数
int lowmac_dp = 350; //偏振延迟时间
int lowmac_sm = 1200; //吹气量 valve/12 = 吹气时间ms
int lowmac_ts = 8; //模板匹配阈值
int lowmac_sg = 60; //偏振绿色通道大小阈值
int lowmac_td = 7; //偏振红色通道差值
Widget::Widget(QWidget *parent) Widget::Widget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::Widget) , ui(new Ui::Widget)
@ -67,7 +73,7 @@ Widget::Widget(QWidget *parent)
connect(timer, &QTimer::timeout, this, &Widget::refreshImage); connect(timer, &QTimer::timeout, this, &Widget::refreshImage);
timer->start(50); // 每50毫秒秒刷新一次界面 timer->start(50); // 每50毫秒秒刷新一次界面
// ui->tabWidget->setCurrentIndex(1); ui->tabWidget->setCurrentIndex(1);
} }
Widget::~Widget() Widget::~Widget()
@ -99,6 +105,39 @@ void Widget::refreshImage()
this->ui->dl_enable_1->setEnabled(!this->isCamRunning); this->ui->dl_enable_1->setEnabled(!this->isCamRunning);
this->ui->tra_enable_0->setEnabled(!this->isCamRunning); this->ui->tra_enable_0->setEnabled(!this->isCamRunning);
this->ui->tra_enable_1->setEnabled(!this->isCamRunning); this->ui->tra_enable_1->setEnabled(!this->isCamRunning);
//
QDateTime now = QDateTime::currentDateTime();
ui->label_currentDateTime->setText(now.toString("yyyy-MM-dd hh:mm:ss"));
if (this->isCamRunning)
{
// 计算启动至今的秒数差
qint64 elapsedSeconds = this->startTime.secsTo(now);
// 转化为小时、分钟、秒
qint64 hours = elapsedSeconds / 3600;
qint64 minutes = (elapsedSeconds % 3600) / 60;
qint64 seconds = elapsedSeconds % 60;
// 将“总运行时间”的小时/分钟分别更新到 UI
ui->label_totalHours->setText(QString::number(hours)); // e.g. "482"
ui->label_totalMinutes->setText(QString::number(minutes)); // e.g. "52"
// 拼接“今日运行时长”一句话 (根据实际需求,可直接使用上面 hours、minutes、seconds)
QString todayRunStr = QString("今日运行时长:%1小时%2分钟%3秒")
.arg(hours)
.arg(minutes)
.arg(seconds);
ui->label_todayRunningTime->setText(todayRunStr);
}
else
{
// 如果设备没在运行UI可以显示默认内容或保持不变
// 下面示例:将运行时长重置为 0
ui->label_totalHours->setText("0");
ui->label_totalMinutes->setText("0");
ui->label_todayRunningTime->setText("今日运行时长:0小时0分钟0秒");
}
// refresh info // refresh info
QString info; QString info;
if(this->isCamRunning) if(this->isCamRunning)
@ -115,6 +154,7 @@ void Widget::refreshImage()
info = "停止"; info = "停止";
}; };
this->ui->lab_info->setText(info); this->ui->lab_info->setText(info);
ui->label_valve_actions->setText(QLocale(QLocale::English).toString(g_valveActionCount));
} }
void Widget::refreshSingleImage(int camera_id, bool overlay_traditional_result, bool overlay_dl_result, bool mirror) void Widget::refreshSingleImage(int camera_id, bool overlay_traditional_result, bool overlay_dl_result, bool mirror)
@ -154,7 +194,6 @@ void Widget::refreshSingleImage(int camera_id, bool overlay_traditional_result,
if (current_id == 0) if (current_id == 0)
return; return;
std::vector<std::vector<uint8_t>> dl_mask; std::vector<std::vector<uint8_t>> dl_mask;
std::vector<std::vector<uint8_t>> traditional_mask; std::vector<std::vector<uint8_t>> traditional_mask;
{ {
@ -294,6 +333,7 @@ void Widget::on_btn_start_clicked()
g_traditional_enable[0] = !this->ui->tra_enable_0->isChecked(); g_traditional_enable[0] = !this->ui->tra_enable_0->isChecked();
g_traditional_enable[1] = !this->ui->tra_enable_1->isChecked(); g_traditional_enable[1] = !this->ui->tra_enable_1->isChecked();
this->isCamRunning = true; this->isCamRunning = true;
this->startTime = QDateTime::currentDateTime(); // 从这里开始计算设备运行时间
// 热身两个工作者 // 热身两个工作者
for(int i = 0; i < 2; ++i) for(int i = 0; i < 2; ++i)
{ {
@ -337,29 +377,29 @@ 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) // for(int i = 0; i < 2; ++i)
{ // {
g_recognitionRunning[i]->store(false); // g_recognitionRunning[i]->store(false);
g_img_Queue[i]->stop(); // 停止队列以唤醒线程 // g_img_Queue[i]->stop(); // 停止队列以唤醒线程
} // }
// 等待检测工作者线程结束 // // 等待检测工作者线程结束
for(int i = 0; i < 2; ++i) // for(int i = 0; i < 2; ++i)
{ // {
if(g_recognitionThread[i] && g_recognitionThread[i]->joinable()) // if(g_recognitionThread[i] && g_recognitionThread[i]->joinable())
{ // {
g_recognitionThread[i]->join(); // g_recognitionThread[i]->join();
delete g_recognitionThread[i]; // delete g_recognitionThread[i];
g_recognitionThread[i] = nullptr; // g_recognitionThread[i] = nullptr;
} // }
if(g_recognitionRunning[i]) // if(g_recognitionRunning[i])
{ // {
delete g_recognitionRunning[i]; // delete g_recognitionRunning[i];
g_recognitionRunning[i] = nullptr; // g_recognitionRunning[i] = nullptr;
} // }
} // }
DestoryCamera(); DestoryCamera();
DestoryLowMac(); DestoryLowMac();

View File

@ -59,6 +59,8 @@ private:
bool isCamRunning; bool isCamRunning;
QDateTime startTime; // 记录点“开始分选”的时间,用于计算总运行时长
QThread storageThread; // 存储线程 QThread storageThread; // 存储线程
StorageWorker* storageWorker; // 存储工作者 StorageWorker* storageWorker; // 存储工作者

167
widget.ui
View File

@ -35,7 +35,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>2</number> <number>1</number>
</property> </property>
<property name="tabBarAutoHide"> <property name="tabBarAutoHide">
<bool>true</bool> <bool>true</bool>
@ -412,12 +412,18 @@ QPushButton#btn_quit:disabled {
</item> </item>
<item> <item>
<widget class="QCheckBox" name="dl_enable_1"> <widget class="QCheckBox" name="dl_enable_1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 12pt &quot;Microsoft YaHei UI&quot;;</string> <string notr="true">font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
</property> </property>
<property name="text"> <property name="text">
<string>屏蔽深度学习</string> <string>屏蔽深度学习</string>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -525,12 +531,18 @@ border: 4px solid black;
</item> </item>
<item> <item>
<widget class="QCheckBox" name="dl_enable_0"> <widget class="QCheckBox" name="dl_enable_0">
<property name="enabled">
<bool>false</bool>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 12pt &quot;Microsoft YaHei UI&quot;;</string> <string notr="true">font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
</property> </property>
<property name="text"> <property name="text">
<string>屏蔽深度学习</string> <string>屏蔽深度学习</string>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -962,7 +974,7 @@ color: rgb(255, 255, 255)</string>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_currentDateTime">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 14pt &quot;Microsoft YaHei UI&quot;; <string notr="true">font: 14pt &quot;Microsoft YaHei UI&quot;;
color: rgb(170, 170, 170)</string> color: rgb(170, 170, 170)</string>
@ -1141,7 +1153,7 @@ border: 3px solid #444;
border-radius: 12px; border-radius: 12px;
padding: 20px; padding: 20px;
min-width: 300px; min-width: 300px;
box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.5);}</string> }</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum> <enum>QFrame::Shape::StyledPanel</enum>
@ -1199,7 +1211,7 @@ background-color: #2d2d2d;;
<enum>QLayout::SizeConstraint::SetMinimumSize</enum> <enum>QLayout::SizeConstraint::SetMinimumSize</enum>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_totalHours">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 700 32pt &quot;Microsoft YaHei UI&quot;; <string notr="true">font: 700 32pt &quot;Microsoft YaHei UI&quot;;
color:rgb(105,186,210); color:rgb(105,186,210);
@ -1212,7 +1224,7 @@ background-color: #2d2d2d;;
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_hourUnit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1231,7 +1243,7 @@ background-color: #2d2d2d;;
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_totalMinutes">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 700 32pt &quot;Microsoft YaHei UI&quot;; <string notr="true">font: 700 32pt &quot;Microsoft YaHei UI&quot;;
color:rgb(105,186,210); color:rgb(105,186,210);
@ -1244,7 +1256,7 @@ background-color: #2d2d2d;;
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_minuteUnit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1280,7 +1292,7 @@ background-color: #2d2d2d;;
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_9"> <layout class="QHBoxLayout" name="horizontalLayout_9">
<item> <item>
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="label_todayRunningTime">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 700 14pt &quot;Microsoft YaHei UI&quot;; <string notr="true">font: 700 14pt &quot;Microsoft YaHei UI&quot;;
color:rgb(169,169,169); color:rgb(169,169,169);
@ -1371,7 +1383,7 @@ border: 3px solid #444;
border-radius: 12px; border-radius: 12px;
padding: 20px; padding: 20px;
min-width: 300px; min-width: 300px;
box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.5);}</string> }</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum> <enum>QFrame::Shape::StyledPanel</enum>
@ -1426,7 +1438,7 @@ background-color: #2d2d2d;;
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_11"> <layout class="QHBoxLayout" name="horizontalLayout_11">
<item> <item>
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="label_valve_actions">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 700 32pt &quot;Microsoft YaHei UI&quot;; <string notr="true">font: 700 32pt &quot;Microsoft YaHei UI&quot;;
color:rgb(105,186,210); color:rgb(105,186,210);
@ -1559,7 +1571,7 @@ border: 3px solid #444;
border-radius: 12px; border-radius: 12px;
padding: 20px; padding: 20px;
min-width: 300px; min-width: 300px;
box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.5);}</string> }</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum> <enum>QFrame::Shape::StyledPanel</enum>
@ -1691,6 +1703,139 @@ color: rgb(144,255,60);r'g'b</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>页</string>
</attribute>
<widget class="QLineEdit" name="lineEdit_search">
<property name="geometry">
<rect>
<x>180</x>
<y>80</y>
<width>301</width>
<height>51</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>80</x>
<y>80</y>
<width>91</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>search</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_dateFilter">
<property name="geometry">
<rect>
<x>600</x>
<y>100</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>550</x>
<y>100</y>
<width>53</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>date</string>
</property>
</widget>
<widget class="QListWidget" name="listWidget_dateTimeline">
<property name="geometry">
<rect>
<x>40</x>
<y>220</y>
<width>241</width>
<height>681</height>
</rect>
</property>
</widget>
<widget class="QListView" name="listView_thumbnails">
<property name="geometry">
<rect>
<x>310</x>
<y>220</y>
<width>621</width>
<height>681</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_imagePreview">
<property name="geometry">
<rect>
<x>970</x>
<y>220</y>
<width>841</width>
<height>521</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_captureTime">
<property name="geometry">
<rect>
<x>1030</x>
<y>800</y>
<width>211</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_dl">
<property name="geometry">
<rect>
<x>1310</x>
<y>790</y>
<width>111</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>DL</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_matrox">
<property name="geometry">
<rect>
<x>1540</x>
<y>790</y>
<width>211</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>traditional</string>
</property>
</widget>
<widget class="QSpinBox" name="spinBox_pagination">
<property name="geometry">
<rect>
<x>490</x>
<y>930</y>
<width>42</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>