|
|
|
@ -69,10 +69,12 @@ void SyncWorkThread::run()
|
|
|
|
|
local_g_image_sync_queue->take(element_vec);
|
|
|
|
|
bool IsNGForAll = false;
|
|
|
|
|
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;
|
|
|
|
|
int j = 0; // 实际工作的相机标识,element_vec中可能有相机没在工作
|
|
|
|
|
for (int i = 0; i < element_vec.size(); i++)//每个相机的图轮流遍历
|
|
|
|
|
{
|
|
|
|
|
local_camera_number = i;
|
|
|
|
|
int isWork = element_vec[i].first;
|
|
|
|
|
std::pair<int, cv::Mat> element;
|
|
|
|
|
element = element_vec[i];
|
|
|
|
|
int unit_count = element.first;
|
|
|
|
@ -110,17 +112,17 @@ void SyncWorkThread::run()
|
|
|
|
|
{
|
|
|
|
|
continue; //图像为空,跳过
|
|
|
|
|
}
|
|
|
|
|
cv::Mat merge_image = cv::Mat::zeros(512 * work_camera_nums, 640 * g_sys_conf.shoot[i], CV_8UC3);
|
|
|
|
|
if (image.channels() == 1)
|
|
|
|
|
{
|
|
|
|
|
cv::cvtColor(image, image, CV_BGR2RGB); //灰度图像转为彩色图像
|
|
|
|
|
}
|
|
|
|
|
cv::resize(image, image, cv::Size(640, 512 * unit_count));
|
|
|
|
|
if (local_SysConf.shoot[local_camera_number] == unit_count)
|
|
|
|
|
{
|
|
|
|
|
cv::Rect roi;
|
|
|
|
|
std::vector<cv::Mat> vec_in;
|
|
|
|
|
int w = image.cols;
|
|
|
|
|
int h = image.rows / unit_count;
|
|
|
|
|
|
|
|
|
|
for (int index = 0; index < unit_count; index++) {
|
|
|
|
|
cv::Rect temp_Rect(0, h * index, w, h);
|
|
|
|
|
cv::Mat temp_image = image(temp_Rect).clone();
|
|
|
|
@ -137,7 +139,7 @@ void SyncWorkThread::run()
|
|
|
|
|
std::vector<std::vector<std::pair<int, cv::Rect>>> vec_results;
|
|
|
|
|
QDateTime ts_start = QDateTime::currentDateTime();
|
|
|
|
|
if (unit_count == 1) {
|
|
|
|
|
std::vector<std::pair<int, cv::Rect> > results;
|
|
|
|
|
std::vector<std::pair<int, cv::Rect>> results;
|
|
|
|
|
cv::Mat imagein, imageout;
|
|
|
|
|
imagein = vec_in[0];
|
|
|
|
|
alg_jd[local_camera_number].detect(imagein, imageout, results);
|
|
|
|
@ -157,7 +159,6 @@ void SyncWorkThread::run()
|
|
|
|
|
#endif
|
|
|
|
|
cv::Mat image1;
|
|
|
|
|
cv::Mat image2;
|
|
|
|
|
|
|
|
|
|
QString jd_no;
|
|
|
|
|
for (int index = 0; index < unit_count; index++) {
|
|
|
|
|
jd_no += QString::number(vec_results[index].size()) + ",";
|
|
|
|
@ -193,10 +194,10 @@ void SyncWorkThread::run()
|
|
|
|
|
/// 合成element_vec.size() * unit_count 宫格图像
|
|
|
|
|
cv::Mat m = vec_in[index].clone();
|
|
|
|
|
QString file_name;
|
|
|
|
|
merge_index = i * unit_count + index + 1;
|
|
|
|
|
|
|
|
|
|
roi = cv::Rect(index * m.cols, i * m.rows, m.cols, m.rows);
|
|
|
|
|
merge_index = j * unit_count + index + 1;
|
|
|
|
|
roi = cv::Rect(index * m.cols, j * m.rows, m.cols, m.rows);
|
|
|
|
|
m.copyTo(merge_image(roi));
|
|
|
|
|
|
|
|
|
|
if (merge_index == work_camera_nums * unit_count) {
|
|
|
|
|
file_name = g_conf_path.save_pics_path + "/"
|
|
|
|
|
+ now_ts.toString("yyyy-MM-dd") + "/"
|
|
|
|
@ -302,13 +303,15 @@ void SyncWorkThread::run()
|
|
|
|
|
#ifdef SYNC_CAMERA
|
|
|
|
|
if (!g_debug_mode)
|
|
|
|
|
{
|
|
|
|
|
emit display_check_total(local_camera_number, ++(frame_total[local_camera_number]));
|
|
|
|
|
if(isWork != 0)
|
|
|
|
|
emit display_check_total(local_camera_number, ++frame_total[local_camera_number]);
|
|
|
|
|
//exportDataInfo.cameraTotal = frame_total;
|
|
|
|
|
emit notify(local_camera_number, 0, image1);
|
|
|
|
|
if (unit_count >= 3)
|
|
|
|
|
emit notify(local_camera_number, 1, image2);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -328,6 +331,7 @@ void SyncWorkThread::run()
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
if (IsNGForAll)
|
|
|
|
|
{
|
|
|
|
|