修复合成图片异常的问题

main
seiyu 10 months ago
parent 1864c6cf04
commit 096007f412

@ -1,4 +1,4 @@
#include "CaptureThreadHIK.h" #include "CaptureThreadHIK.h"
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
#include "PLCDevice.h" #include "PLCDevice.h"
#include "common.h" #include "common.h"
@ -48,7 +48,6 @@ inline void FallingGpioEventfunction(MV_EVENT_OUT_INFO* pEventInfo, void* pUser)
{ {
CaptureThreadHIKptr->p_image_sync_queue->put(CaptureThreadHIKptr->p_image_sync_arr->image_sync_arr); CaptureThreadHIKptr->p_image_sync_queue->put(CaptureThreadHIKptr->p_image_sync_arr->image_sync_arr);
CaptureThreadHIKptr->p_image_sync_arr->collect_cnt = 0; CaptureThreadHIKptr->p_image_sync_arr->collect_cnt = 0;
//CaptureThreadHIKptr->p_image_sync_arr->image_sync_arr.swap(std::vector<std::pair<int, cv::Mat>>());
} }
} }
#else #else

@ -1,4 +1,4 @@
#include "SyncWorkThread.h" #include "SyncWorkThread.h"
#include "alg_jd.h" #include "alg_jd.h"
#include "common.h" #include "common.h"
#include "balluffcamera.h" #include "balluffcamera.h"
@ -70,6 +70,7 @@ void SyncWorkThread::run()
local_g_image_sync_queue->take(element_vec); local_g_image_sync_queue->take(element_vec);
bool IsNGForAll = false; bool IsNGForAll = false;
int merge_index; int merge_index;
cv::Mat merge_image = cv::Mat::zeros(512 * work_camera_nums, 640 * g_sys_conf.shoot[0], CV_8UC3);
cv::Rect roi; cv::Rect roi;
int j = 0; // 实际工作的相机标识element_vec中可能有相机没在工作 int j = 0; // 实际工作的相机标识element_vec中可能有相机没在工作
for (int i = 0; i < element_vec.size(); i++)//每个相机的图轮流遍历 for (int i = 0; i < element_vec.size(); i++)//每个相机的图轮流遍历
@ -78,7 +79,6 @@ void SyncWorkThread::run()
continue; continue;
local_camera_number = i; local_camera_number = i;
int isWork = element_vec[i].first;
std::pair<int, cv::Mat> element; std::pair<int, cv::Mat> element;
element = element_vec[i]; element = element_vec[i];
int unit_count = element.first; int unit_count = element.first;
@ -116,7 +116,6 @@ void SyncWorkThread::run()
{ {
continue; //图像为空,跳过 continue; //图像为空,跳过
} }
cv::Mat merge_image = cv::Mat::zeros(512 * work_camera_nums, 640 * g_sys_conf.shoot[i], CV_8UC3);
if (image.channels() == 1) if (image.channels() == 1)
{ {
cv::cvtColor(image, image, CV_BGR2RGB); //灰度图像转为彩色图像 cv::cvtColor(image, image, CV_BGR2RGB); //灰度图像转为彩色图像
@ -195,7 +194,7 @@ void SyncWorkThread::run()
} }
if (local_SysConf.save == 2)//三张照片分别存储 if (local_SysConf.save == 2)//三张照片分别存储
{ {
/// 合成element_vec.size() * unit_count 宫格图像 /// 合成work_camera_nums * unit_count 宫格图像
cv::Mat m = vec_in[index].clone(); cv::Mat m = vec_in[index].clone();
QString file_name; QString file_name;
merge_index = j * unit_count + index + 1; merge_index = j * unit_count + index + 1;

Loading…
Cancel
Save