dual cam verssion

This commit is contained in:
XinJiang1 2024-12-22 21:28:09 +08:00
parent fd7df4545e
commit 18e2f3080d
6 changed files with 66 additions and 59 deletions

View File

@ -163,7 +163,7 @@ MIL_INT ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
//拷贝存图图像 //拷贝存图图像
MbufCopy(ModifiedBufferId0,MilImage0); MbufCopy(ModifiedBufferId0,MilImage0);
//Mil保存路径 //Mil保存路径
QString MilImgPath = QString("C:/Users/Pc/Desktop/cotton_double2/Img1/%1.bmp").arg(FuncCount0); QString MilImgPath = QString("C:/Users/Administrator/Desktop/1/%1.bmp").arg(FuncCount0);
MIL_STRING MilImagePath = MilImgPath.toStdWString(); MIL_STRING MilImagePath = MilImgPath.toStdWString();
MbufExport(MilImagePath,M_BMP,MilImage0); MbufExport(MilImagePath,M_BMP,MilImage0);
qDebug()<<"回调1成功存储照片:"<<FuncCount0<<""; qDebug()<<"回调1成功存储照片:"<<FuncCount0<<"";
@ -227,7 +227,7 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
//拷贝存图数据 //拷贝存图数据
MbufCopy(ModifiedBufferId1,MilImage1); MbufCopy(ModifiedBufferId1,MilImage1);
//Mil保存路径 //Mil保存路径
QString MilImgPath = QString("C:/Users/Pc/Desktop/cotton_double2/Img2/%1.bmp").arg(FuncCount1); QString MilImgPath = QString("C:/Users/Administrator/Desktop/2/%1.bmp").arg(FuncCount1);
MIL_STRING MilImagePath = MilImgPath.toStdWString(); MIL_STRING MilImagePath = MilImgPath.toStdWString();
MbufExport(MilImagePath,M_BMP,MilImage1); MbufExport(MilImagePath,M_BMP,MilImage1);
qDebug()<<"回调2成功存储照片:"<<FuncCount1<<""; qDebug()<<"回调2成功存储照片:"<<FuncCount1<<"";

View File

@ -17,12 +17,13 @@
/ /
/ /
/ /
/
[CAMERA_NAME] [CAMERA_NAME]
no name no name
[CONFIG_FILE] [CONFIG_FILE]
50CF 50CF
ODYSSEY ODYSSEY
Mon Dec 9 16:10:06 2024 Sun Dec 22 20:52:23 2024
[INFO_FILE_REV] [INFO_FILE_REV]
0010.0019.0000 0010.0019.0000
RADIENT/eVCL/DUAL RADIENT/eVCL/DUAL
@ -119,8 +120,8 @@ VDT_HSYNC_FREQ
VDT_VSYNC 0x0 VDT_VSYNC 0x0
VDT_VBPORCH 0x0 VDT_VBPORCH 0x0
VDT_VFPORCH 0x0 VDT_VFPORCH 0x0
VDT_VACTIVE 0x400 VDT_VACTIVE 0x200
VDT_VTOTAL 0x400 VDT_VTOTAL 0x200
VDT_VSYNC_FREQ 0x0 VDT_VSYNC_FREQ 0x0
VDT_CL_IMAGE_SIZE_X 0x0 VDT_CL_IMAGE_SIZE_X 0x0
VDT_CL_IMAGE_SIZE_Y 0x0 VDT_CL_IMAGE_SIZE_Y 0x0
@ -1560,8 +1561,8 @@ DEF_ADD_HACTIVE_MULTIPLEX
DEF_ADD_VACTIVE_MULTIPLEX 0x0 DEF_ADD_VACTIVE_MULTIPLEX 0x0
DEF_HTOTAL_ENTRY 0x1000 DEF_HTOTAL_ENTRY 0x1000
DEF_HACTIVE_ENTRY 0x1000 DEF_HACTIVE_ENTRY 0x1000
DEF_VTOTAL_ENTRY 0x400 DEF_VTOTAL_ENTRY 0x200
DEF_VACTIVE_ENTRY 0x400 DEF_VACTIVE_ENTRY 0x200
DEF_CL_NEW_HCROPPING 0x0 DEF_CL_NEW_HCROPPING 0x0
DEF_CL_NEW_VCROPPING 0x0 DEF_CL_NEW_VCROPPING 0x0
DEF_NTSC 0x0 DEF_NTSC 0x0
@ -1582,7 +1583,7 @@ DEF_ADD_HTOTAL_EQUA_HEVAL
DEF_HOR_COUNT_MAX_BITWISE 0xffff DEF_HOR_COUNT_MAX_BITWISE 0xffff
DEF_VERT_COUNT_MAX_BITWISE 0xffff DEF_VERT_COUNT_MAX_BITWISE 0xffff
DEF_DIG_HTOTAL 0x1002 DEF_DIG_HTOTAL 0x1002
DEF_DIG_VTOTAL 0x3ff DEF_DIG_VTOTAL 0x1ff
DEF_TEST_MODE_HFP_MIN 0x0 DEF_TEST_MODE_HFP_MIN 0x0
DEF_TEST_MODE_HSY_HBP_MIN_CL 0x0 DEF_TEST_MODE_HSY_HBP_MIN_CL 0x0
DEF_TEST_MODE_VFP_MIN 0x0 DEF_TEST_MODE_VFP_MIN 0x0
@ -1729,7 +1730,7 @@ DEF_DIG1_BYTESORDER
INFO_CUSTOM 0x0 INFO_CUSTOM 0x0
INFO_REGISTER_REV 0x1 INFO_REGISTER_REV 0x1
INFO_XSIZE 0x1000 INFO_XSIZE 0x1000
INFO_YSIZE 0x400 INFO_YSIZE 0x200
INFO_TYPE 0x1 INFO_TYPE 0x1
INFO_BAYER 0x0 INFO_BAYER 0x0
INFO_BURSTSIZE 0x0 INFO_BURSTSIZE 0x0
@ -1933,7 +1934,7 @@ DIG_HSCLM
DIG_HECLM 0x0 DIG_HECLM 0x0
DIG_HCTL 0x1e0 DIG_HCTL 0x1e0
DIG_VCNT 0x1 DIG_VCNT 0x1
DIG_VTOTAL 0x3ff DIG_VTOTAL 0x1ff
DIG_VSCNT 0x0 DIG_VSCNT 0x0
DIG_VECNT 0x0 DIG_VECNT 0x0
DIG_VSSYNC 0x0 DIG_VSSYNC 0x0
@ -2348,5 +2349,5 @@ DIG_IOCTL1H
DIG_IOCTL0_L not_modified DIG_IOCTL0_L not_modified
DIG_ENCTL not_modified DIG_ENCTL not_modified
[EOF] [EOF]
00007FF687B3AAA8 0x400b8 00007FF72205AAA8 0x400bb
00007FF687B3AA90 0x48b1c582 00007FF72205AA90 0x2b19a5ff

View File

@ -15,19 +15,22 @@ QPixmap ImageUtils::mat2QPixmap(const cv::Mat& mat)
// 灰度图像 // 灰度图像
img = QImage(mat.data, mat.cols, mat.rows, static_cast<int>(mat.step), QImage::Format_Grayscale8).copy(); img = QImage(mat.data, mat.cols, mat.rows, static_cast<int>(mat.step), QImage::Format_Grayscale8).copy();
} }
else if(mat.channels() == 3){ else if(mat.channels() == 3)
{
// 彩色图像 (OpenCV 默认是 BGR需要转换为 RGB) // 彩色图像 (OpenCV 默认是 BGR需要转换为 RGB)
cv::Mat rgb; cv::Mat rgb;
cv::cvtColor(mat, rgb, cv::COLOR_BGR2RGB); cv::cvtColor(mat, rgb, cv::COLOR_BGR2RGB);
img = QImage(rgb.data, rgb.cols, rgb.rows, static_cast<int>(rgb.step), QImage::Format_RGB888).copy(); img = QImage(rgb.data, rgb.cols, rgb.rows, static_cast<int>(rgb.step), QImage::Format_RGB888).copy();
} }
else if(mat.channels() == 4){ else if(mat.channels() == 4)
{
// 如果需要处理带有透明通道的图像 (BGRA 转 RGBA) // 如果需要处理带有透明通道的图像 (BGRA 转 RGBA)
cv::Mat rgba; cv::Mat rgba;
cv::cvtColor(mat, rgba, cv::COLOR_BGRA2RGBA); cv::cvtColor(mat, rgba, cv::COLOR_BGRA2RGBA);
img = QImage(rgba.data, rgba.cols, rgba.rows, static_cast<int>(rgba.step), QImage::Format_RGBA8888).copy(); img = QImage(rgba.data, rgba.cols, rgba.rows, static_cast<int>(rgba.step), QImage::Format_RGBA8888).copy();
} }
else{ else
{
// 不支持的图像格式 // 不支持的图像格式
std::cout << "Unsupported Mat format with channels:" << mat.channels(); std::cout << "Unsupported Mat format with channels:" << mat.channels();
return QPixmap(); return QPixmap();

View File

@ -37,10 +37,10 @@ public:
QLabel *lab_info; QLabel *lab_info;
QPushButton *pushButton; QPushButton *pushButton;
QPushButton *btn_stop; QPushButton *btn_stop;
QLabel *camera_0_img;
QLabel *camera_1_img; QLabel *camera_1_img;
QLabel *label_2; QLabel *label_2;
QLabel *label_3; QLabel *label_3;
QLabel *camera_0_img;
QWidget *tab_3; QWidget *tab_3;
QLabel *label_title_3; QLabel *label_title_3;
QGroupBox *groupBox_4; QGroupBox *groupBox_4;
@ -130,11 +130,6 @@ public:
btn_stop = new QPushButton(tab_2); btn_stop = new QPushButton(tab_2);
btn_stop->setObjectName("btn_stop"); btn_stop->setObjectName("btn_stop");
btn_stop->setGeometry(QRect(20, 190, 101, 41)); btn_stop->setGeometry(QRect(20, 190, 101, 41));
camera_0_img = new QLabel(tab_2);
camera_0_img->setObjectName("camera_0_img");
camera_0_img->setGeometry(QRect(160, 40, 591, 191));
camera_0_img->setStyleSheet(QString::fromUtf8("background-color: rgb(129, 129, 129);\n"
"border: 4px solid black;"));
camera_1_img = new QLabel(tab_2); camera_1_img = new QLabel(tab_2);
camera_1_img->setObjectName("camera_1_img"); camera_1_img->setObjectName("camera_1_img");
camera_1_img->setGeometry(QRect(160, 290, 591, 191)); camera_1_img->setGeometry(QRect(160, 290, 591, 191));
@ -147,6 +142,12 @@ public:
label_3 = new QLabel(tab_2); label_3 = new QLabel(tab_2);
label_3->setObjectName("label_3"); label_3->setObjectName("label_3");
label_3->setGeometry(QRect(160, 20, 141, 16)); label_3->setGeometry(QRect(160, 20, 141, 16));
camera_0_img = new QLabel(tab_2);
camera_0_img->setObjectName("camera_0_img");
camera_0_img->setGeometry(QRect(160, 50, 591, 191));
camera_0_img->setStyleSheet(QString::fromUtf8("background-color: rgb(129, 129, 129);\n"
"border: 4px solid black;"));
camera_0_img->setLineWidth(1);
tabWidget->addTab(tab_2, QString()); tabWidget->addTab(tab_2, QString());
tab_3 = new QWidget(); tab_3 = new QWidget();
tab_3->setObjectName("tab_3"); tab_3->setObjectName("tab_3");
@ -238,10 +239,10 @@ public:
lab_info->setText(QCoreApplication::translate("Widget", "\345\207\206\345\244\207\344\270\255", nullptr)); lab_info->setText(QCoreApplication::translate("Widget", "\345\207\206\345\244\207\344\270\255", nullptr));
pushButton->setText(QCoreApplication::translate("Widget", "\345\274\200\345\247\213\345\210\206\351\200\211", nullptr)); pushButton->setText(QCoreApplication::translate("Widget", "\345\274\200\345\247\213\345\210\206\351\200\211", nullptr));
btn_stop->setText(QCoreApplication::translate("Widget", "\345\201\234\346\255\242\345\210\206\351\200\211", nullptr)); btn_stop->setText(QCoreApplication::translate("Widget", "\345\201\234\346\255\242\345\210\206\351\200\211", nullptr));
camera_0_img->setText(QString());
camera_1_img->setText(QString()); camera_1_img->setText(QString());
label_2->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\2721\357\274\210\351\253\230\344\276\247/\346\260\224\347\275\220\344\276\247\357\274\211", nullptr)); label_2->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\2721\357\274\210\351\253\230\344\276\247/\346\260\224\347\275\220\344\276\247\357\274\211", nullptr));
label_3->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\2720\357\274\210\344\275\216\344\276\247/\345\207\272\351\243\216\345\217\243\344\276\247\357\274\211", nullptr)); label_3->setText(QCoreApplication::translate("Widget", "\347\233\270\346\234\2720\357\274\210\344\275\216\344\276\247/\345\207\272\351\243\216\345\217\243\344\276\247\357\274\211", nullptr));
camera_0_img->setText(QString());
tabWidget->setTabText(tabWidget->indexOf(tab_2), QCoreApplication::translate("Widget", "Tab 2", nullptr)); tabWidget->setTabText(tabWidget->indexOf(tab_2), QCoreApplication::translate("Widget", "Tab 2", nullptr));
label_title_3->setText(QCoreApplication::translate("Widget", "\345\217\202\346\225\260\350\256\276\347\275\256\347\225\214\351\235\242", nullptr)); label_title_3->setText(QCoreApplication::translate("Widget", "\345\217\202\346\225\260\350\256\276\347\275\256\347\225\214\351\235\242", nullptr));
groupBox_4->setTitle(QCoreApplication::translate("Widget", "\344\270\213\344\275\215\346\234\272\345\217\202\346\225\260", nullptr)); groupBox_4->setTitle(QCoreApplication::translate("Widget", "\344\270\213\344\275\215\346\234\272\345\217\202\346\225\260", nullptr));

View File

@ -27,6 +27,7 @@ Widget::Widget(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->camera_0_img->setScaledContents(true); ui->camera_0_img->setScaledContents(true);
ui->camera_1_img->setScaledContents(true);
iniColor(); iniColor();
@ -88,28 +89,26 @@ void Widget::refreshSingleImage(int camera_id, bool overlay_result)
{ {
QMutexLocker locker(&gDispPicMutex1); QMutexLocker locker(&gDispPicMutex1);
current_id = gDispCurrentPicId1; current_id = gDispCurrentPicId1;
}
if (current_id == 0) if (current_id == 0)
return; return;
cv::Mat img = ImageUtils::mil2Mat(current_id); cv::Mat img = ImageUtils::mil2Mat(current_id);
//进行结果的转化叠加 //进行结果的转化叠加
if (overlay_result) if (overlay_result)
{
MIL_ID mask_id = 0;
{ {
MIL_ID mask_id = 0; QMutexLocker locker(&gMaskMutex1);
{ mask_id = gMask1;
QMutexLocker locker(&gMaskMutex1);
mask_id = gMask1;
}
cv::Mat mask = ImageUtils::mil2Mat(mask_id);
img = ImageUtils::overlayResultOnInput(img,mask,0.5);
}
//刷新显示
QPixmap pixmap1 = ImageUtils::mat2QPixmap(img);
if (!pixmap1.isNull())
{
ui->camera_1_img->setPixmap(pixmap1);
} }
cv::Mat mask = ImageUtils::mil2Mat(mask_id);
img = ImageUtils::overlayResultOnInput(img,mask,0.5);
}
//刷新显示
QPixmap pixmap1 = ImageUtils::mat2QPixmap(img);
if (!pixmap1.isNull())
{
ui->camera_1_img->setPixmap(pixmap1);
} }
} }
else else

View File

@ -300,23 +300,6 @@
<string>停止分选</string> <string>停止分选</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="camera_0_img">
<property name="geometry">
<rect>
<x>160</x>
<y>40</y>
<width>591</width>
<height>191</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(129, 129, 129);
border: 4px solid black;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="camera_1_img"> <widget class="QLabel" name="camera_1_img">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -363,6 +346,26 @@ border: 4px solid black;</string>
<string>相机0低侧/出风口侧)</string> <string>相机0低侧/出风口侧)</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="camera_0_img">
<property name="geometry">
<rect>
<x>160</x>
<y>50</y>
<width>591</width>
<height>191</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(129, 129, 129);
border: 4px solid black;</string>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">