no message
This commit is contained in:
parent
d12a893506
commit
f6182b8c7b
12
camera.cpp
12
camera.cpp
@ -81,8 +81,8 @@ bool iniCamera()
|
|||||||
MsysAlloc(M_DEFAULT, M_SYSTEM_RADIENTEVCL, M_DEV0, M_DEFAULT, &MilSystem);
|
MsysAlloc(M_DEFAULT, M_SYSTEM_RADIENTEVCL, M_DEV0, M_DEFAULT, &MilSystem);
|
||||||
|
|
||||||
//分配相机 digitier
|
//分配相机 digitier
|
||||||
MdigAlloc(MilSystem,M_DEV0,MIL_TEXT("C:/Users/Pc/Desktop/1.dcf"),M_DEFAULT,&MilDigitizer0);
|
MdigAlloc(MilSystem,M_DEV0,MIL_TEXT("C:/Users/Administrator/Desktop/cotton_double/config/1.dcf"),M_DEFAULT,&MilDigitizer0);
|
||||||
MdigAlloc(MilSystem,M_DEV1,MIL_TEXT("C:/Users/Pc/Desktop/2.dcf"),M_DEFAULT,&MilDigitizer1);
|
MdigAlloc(MilSystem,M_DEV1,MIL_TEXT("C:/Users/Administrator/Desktop/cotton_double/config/2.dcf"),M_DEFAULT,&MilDigitizer1);
|
||||||
|
|
||||||
//给MilImage分配空间
|
//给MilImage分配空间
|
||||||
MbufAllocColor(MilSystem,3,BufSizeX0,BufSizeY0,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&MilImage0);
|
MbufAllocColor(MilSystem,3,BufSizeX0,BufSizeY0,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&MilImage0);
|
||||||
@ -92,7 +92,8 @@ bool iniCamera()
|
|||||||
MbufAllocColor(MilSystem,3,BufSizeX0,BufSizeY0,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&detection_result0);
|
MbufAllocColor(MilSystem,3,BufSizeX0,BufSizeY0,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&detection_result0);
|
||||||
MbufAllocColor(MilSystem,3,BufSizeX1,BufSizeY1,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&detection_result1);
|
MbufAllocColor(MilSystem,3,BufSizeX1,BufSizeY1,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&detection_result1);
|
||||||
MbufAllocColor(MilSystem,3,BufSizeX0,BufSizeY0,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&MilImage_Onnx0);
|
MbufAllocColor(MilSystem,3,BufSizeX0,BufSizeY0,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&MilImage_Onnx0);
|
||||||
MbufAllocColor(MilSystem,3,BufSizeX1,BufSizeY1,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&MilImage_Onnx1);
|
MbufAllocColor(MilSystem,3,BufSizeX1,BufSizeY1,8 + M_UNSIGNED,M_IMAGE + M_GRAB + M_PROC,&MilImage_Onnx1);;
|
||||||
|
|
||||||
|
|
||||||
//给每一个bufferlist分配空间
|
//给每一个bufferlist分配空间
|
||||||
for (int i = 0; i < 20; i++)
|
for (int i = 0; i < 20; i++)
|
||||||
@ -150,7 +151,9 @@ MIL_INT ProcessingFunction0(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
|
|||||||
|
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gDispPicMutex0);
|
QMutexLocker locker(&gDispPicMutex0);
|
||||||
|
// MbufCopy(ModifiedBufferId0,gDispCurrentPic0);
|
||||||
gDispCurrentPicId0 = ModifiedBufferId0;
|
gDispCurrentPicId0 = ModifiedBufferId0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SaveImg_Flag)
|
if(SaveImg_Flag)
|
||||||
@ -253,6 +256,7 @@ MIL_INT ProcessingFunction1(MIL_INT HookType, MIL_ID HookId, void *HookDataPtr)
|
|||||||
// Update the current Img MIl id
|
// Update the current Img MIl id
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gDispPicMutex1);
|
QMutexLocker locker(&gDispPicMutex1);
|
||||||
|
// MbufCopy(ModifiedBufferId0,gDispCurrentPic1);
|
||||||
gDispCurrentPicId1 = ModifiedBufferId1;
|
gDispCurrentPicId1 = ModifiedBufferId1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,7 +814,7 @@ Mat mil2mat(const MIL_ID mil_img) {
|
|||||||
|
|
||||||
bool iniColor()
|
bool iniColor()
|
||||||
{
|
{
|
||||||
read_params_from_file("C:/Users/Pc/Desktop/color_range_config.txt", params);
|
read_params_from_file("C:/Users/Administrator/Desktop/cotton_double/config/color_range_config.txt", params);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
// 图片显示0
|
// 图片显示0
|
||||||
QMutex gDispPicMutex0;
|
QMutex gDispPicMutex0;
|
||||||
MIL_ID gDispCurrentPicId0 = 0;
|
MIL_ID gDispCurrentPicId0;
|
||||||
|
|
||||||
// 图片显示1
|
// 图片显示1
|
||||||
QMutex gDispPicMutex1;
|
QMutex gDispPicMutex1;
|
||||||
MIL_ID gDispCurrentPicId1 = 0;
|
MIL_ID gDispCurrentPicId1;
|
||||||
|
|||||||
@ -64,9 +64,9 @@ cv::Mat ImageUtils::mil2Mat(const MIL_ID mil_img)
|
|||||||
if (channels == 3) {
|
if (channels == 3) {
|
||||||
// 多通道图像,分通道读取
|
// 多通道图像,分通道读取
|
||||||
MIL_ID redChannel, greenChannel, blueChannel;
|
MIL_ID redChannel, greenChannel, blueChannel;
|
||||||
MbufAlloc2d(M_DEFAULT, width, height, 8 + M_UNSIGNED, M_IMAGE + M_PROC, &redChannel);
|
MbufAlloc2d(MilSystem, width, height, 8 + M_UNSIGNED, M_IMAGE + M_PROC, &redChannel);
|
||||||
MbufAlloc2d(M_DEFAULT, width, height, 8 + M_UNSIGNED, M_IMAGE + M_PROC, &greenChannel);
|
MbufAlloc2d(MilSystem, width, height, 8 + M_UNSIGNED, M_IMAGE + M_PROC, &greenChannel);
|
||||||
MbufAlloc2d(M_DEFAULT, width, height, 8 + M_UNSIGNED, M_IMAGE + M_PROC, &blueChannel);
|
MbufAlloc2d(MilSystem, width, height, 8 + M_UNSIGNED, M_IMAGE + M_PROC, &blueChannel);
|
||||||
|
|
||||||
// 将 MIL 图像的各个通道复制到单通道缓冲区
|
// 将 MIL 图像的各个通道复制到单通道缓冲区
|
||||||
MbufCopyColor(mil_img, redChannel, M_RED);
|
MbufCopyColor(mil_img, redChannel, M_RED);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
** Form generated from reading UI file 'widget.ui'
|
** Form generated from reading UI file 'widget.ui'
|
||||||
**
|
**
|
||||||
** Created by: Qt User Interface Compiler version 6.8.1
|
** Created by: Qt User Interface Compiler version 6.7.3
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|||||||
37
widget.cpp
37
widget.cpp
@ -36,7 +36,7 @@ Widget::Widget(QWidget *parent)
|
|||||||
// 启动显示定时器,每秒检查一次
|
// 启动显示定时器,每秒检查一次
|
||||||
QTimer* timer = new QTimer(this);
|
QTimer* timer = new QTimer(this);
|
||||||
connect(timer, &QTimer::timeout, this, &Widget::refreshImage);
|
connect(timer, &QTimer::timeout, this, &Widget::refreshImage);
|
||||||
timer->start(50); // 每50毫秒秒刷新一次界面
|
timer->start(100); // 每50毫秒秒刷新一次界面
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
@ -60,16 +60,16 @@ void Widget::refreshSingleImage(int camera_id)
|
|||||||
{
|
{
|
||||||
QMutexLocker locker(&gDispPicMutex0);
|
QMutexLocker locker(&gDispPicMutex0);
|
||||||
current_id = gDispCurrentPicId0;
|
current_id = gDispCurrentPicId0;
|
||||||
}
|
|
||||||
if (current_id == 0)
|
|
||||||
return;
|
|
||||||
// 获取 QPixmap 并设置到 QLabel
|
|
||||||
QPixmap pixmap0 = ImageUtils::mat2QPixmap(ImageUtils::mil2Mat(current_id));
|
|
||||||
if (!pixmap0.isNull())
|
|
||||||
{
|
|
||||||
ui->camera_0_img->setPixmap(pixmap0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (current_id == 0)
|
||||||
|
return;
|
||||||
|
// 获取 QPixmap 并设置到 QLabel
|
||||||
|
QPixmap pixmap0 = ImageUtils::mat2QPixmap(ImageUtils::mil2Mat(current_id));
|
||||||
|
if (!pixmap0.isNull())
|
||||||
|
{
|
||||||
|
ui->camera_0_img->setPixmap(pixmap0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 更新当前的图片1
|
// 更新当前的图片1
|
||||||
else if (camera_id == 1)
|
else if (camera_id == 1)
|
||||||
@ -77,15 +77,16 @@ void Widget::refreshSingleImage(int camera_id)
|
|||||||
{
|
{
|
||||||
QMutexLocker locker(&gDispPicMutex1);
|
QMutexLocker locker(&gDispPicMutex1);
|
||||||
current_id = gDispCurrentPicId1;
|
current_id = gDispCurrentPicId1;
|
||||||
}
|
|
||||||
|
|
||||||
if (current_id == 0)
|
|
||||||
return;
|
if (current_id == 0)
|
||||||
// 获取 QPixmap 并设置到 QLabel
|
return;
|
||||||
QPixmap pixmap1 = ImageUtils::mat2QPixmap(ImageUtils::mil2Mat(current_id));
|
// 获取 QPixmap 并设置到 QLabel
|
||||||
if (!pixmap1.isNull())
|
QPixmap pixmap1 = ImageUtils::mat2QPixmap(ImageUtils::mil2Mat(current_id));
|
||||||
{
|
if (!pixmap1.isNull())
|
||||||
ui->camera_1_img->setPixmap(pixmap1);
|
{
|
||||||
|
ui->camera_1_img->setPixmap(pixmap1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user