|
|
|
@ -72,7 +72,7 @@ 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::Mat merge_image = cv::Mat::zeros(512 * g_sys_conf.shoot[0], 640 * work_camera_nums, CV_8UC3);
|
|
|
|
|
cv::Rect roi;
|
|
|
|
|
int j = 0; // 实际工作的相机标识,element_vec中可能有相机没在工作
|
|
|
|
|
for (int i = 0; i < element_vec.size(); i++)//每个相机的图轮流遍历
|
|
|
|
@ -175,13 +175,14 @@ void SyncWorkThread::run()
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDPSendInfo.JD = jd_no;
|
|
|
|
|
#endif
|
|
|
|
|
IsALL = false;//4.10
|
|
|
|
|
bool IsNG = false;
|
|
|
|
|
int ngReason = 0;
|
|
|
|
|
QMap<int, QString> ng_reason_maps;
|
|
|
|
|
ng_reason_maps[0] = "OK";
|
|
|
|
|
ng_reason_maps[1] = "less_than_setting";
|
|
|
|
|
ng_reason_maps[2] = "too_diff_from_model";
|
|
|
|
|
ng_reason_maps[3] = "out_of_setting_range";
|
|
|
|
|
ng_reason_maps[0] = "1";
|
|
|
|
|
ng_reason_maps[1] = "0";
|
|
|
|
|
ng_reason_maps[2] = "0";
|
|
|
|
|
ng_reason_maps[3] = "0";
|
|
|
|
|
for (int index = 0; index < unit_count; index++) {
|
|
|
|
|
if (vec_results[index].size() < local_SysConf.no[local_camera_number][index])
|
|
|
|
|
{
|
|
|
|
@ -277,15 +278,17 @@ void SyncWorkThread::run()
|
|
|
|
|
|
|
|
|
|
for (int index = 0; index < unit_count; index++)
|
|
|
|
|
{
|
|
|
|
|
cv::Mat m = vec_in[index].clone();
|
|
|
|
|
QString file_name = g_conf_path.save_pics_path + "/ng/" +
|
|
|
|
|
now_ts.toString("yyyy-MM-dd") + "/"
|
|
|
|
|
+ QString::number(local_camera_number + 1) + "/" + QString::number(index + 1) + "/" +
|
|
|
|
|
now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + QString::number(local_camera_number + 1) +
|
|
|
|
|
"#" + "_" + QString::number(index + 1) + "_" + ng_reason_maps[ngReason] +
|
|
|
|
|
".jpg";
|
|
|
|
|
|
|
|
|
|
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
|
|
|
|
|
if (vec_results[index].size() < local_SysConf.no[local_camera_number][index])
|
|
|
|
|
{
|
|
|
|
|
cv::Mat m = vec_in[index].clone();
|
|
|
|
|
QString file_name = g_conf_path.save_pics_path + "/ng/" +
|
|
|
|
|
now_ts.toString("yyyy-MM-dd") + "/"
|
|
|
|
|
+ QString::number(local_camera_number + 1) + "/" + QString::number(index + 1) + "/" +
|
|
|
|
|
now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + QString::number(local_camera_number + 1) +
|
|
|
|
|
"#" + "_" + QString::number(index + 1) + "_" + ng_reason_maps[ngReason] +
|
|
|
|
|
".jpg";
|
|
|
|
|
|
|
|
|
|
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
|
|
|
|
|
|
|
|
|
|
m = vec_out[index].clone();
|
|
|
|
|
file_name = g_conf_path.save_pics_path + "/ng_result/" +
|
|
|
|
@ -296,6 +299,7 @@ void SyncWorkThread::run()
|
|
|
|
|
".jpg";
|
|
|
|
|
|
|
|
|
|
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -320,16 +324,26 @@ void SyncWorkThread::run()
|
|
|
|
|
cv::Mat m = vec_in[index].clone();
|
|
|
|
|
QString file_name;
|
|
|
|
|
merge_index = j * unit_count + index + 1;
|
|
|
|
|
roi = cv::Rect(index * m.cols, j * m.rows, m.cols, m.rows);
|
|
|
|
|
roi = cv::Rect(j * m.cols, index * m.rows, m.cols, m.rows);
|
|
|
|
|
m.copyTo(merge_image(roi));
|
|
|
|
|
|
|
|
|
|
if (merge_index == work_camera_nums * unit_count) {
|
|
|
|
|
|
|
|
|
|
if (IsNGForAll)
|
|
|
|
|
{
|
|
|
|
|
ngReason = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ngReason = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
file_name = g_conf_path.save_pics_path + "/"
|
|
|
|
|
+ now_ts.toString("yyyy-MM-dd") + "/"
|
|
|
|
|
+ now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + "_" + ng_reason_maps[ngReason] + ".jpg";
|
|
|
|
|
+ now_ts.toString("yyyy-MM-dd") + "/"+"416_BJ_01_"
|
|
|
|
|
+ now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz_") + ng_reason_maps[ngReason] + ".jpg";
|
|
|
|
|
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), merge_image));
|
|
|
|
|
#ifdef __TCPSend
|
|
|
|
|
QString sendName = now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + ng_reason_maps[ngReason] + ".jpg";
|
|
|
|
|
QString sendName = "416_BJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz_") + ng_reason_maps[ngReason];
|
|
|
|
|
TCPSendInfo.pics_name = sendName.toLocal8Bit().constData();
|
|
|
|
|
TCP_Info_queue->put(TCPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
@ -360,8 +374,15 @@ void SyncWorkThread::run()
|
|
|
|
|
}
|
|
|
|
|
if (IsNGForAll)
|
|
|
|
|
{
|
|
|
|
|
/*to do something*/
|
|
|
|
|
local_g_result_queue->put(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
local_g_result_queue->put(true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// emit display_check_total(local_camera_number, ++(frame_total[local_camera_number]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (cv::Exception& e)
|
|
|
|
|