|
|
|
@ -68,27 +68,17 @@ void SyncWorkThread::run()
|
|
|
|
|
uint32_t result_index[NumberOfSupportedCameras] = { 0 };
|
|
|
|
|
while (!b_quit) {
|
|
|
|
|
QDateTime now_ts = QDateTime::currentDateTime();
|
|
|
|
|
//#ifdef __TCPSend
|
|
|
|
|
// _TCPSendInfo TCPSendInfo;
|
|
|
|
|
//#ifdef __TCPSend
|
|
|
|
|
// QString sendName = "416_BJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz");
|
|
|
|
|
// TCPSendInfo.pics_name = sendName.toLocal8Bit().constData();
|
|
|
|
|
// TCP_Info_queue->put(TCPSendInfo);
|
|
|
|
|
//#endif
|
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
|
|
std::vector<std::pair<int, cv::Mat>> element_vec;
|
|
|
|
|
local_g_image_sync_queue->take(element_vec);
|
|
|
|
|
bool IsNGForAll = false;
|
|
|
|
|
int merge_index;
|
|
|
|
|
cv::Mat merge_image = cv::Mat::zeros(512 * g_sys_conf.shoot[0], 640 * work_camera_nums, CV_8UC3);
|
|
|
|
|
cv::Mat merge_image = cv::Mat::zeros(image_h * g_sys_conf.shoot[0], image_w * work_camera_nums, CV_8UC3);//640*work_camera_nums
|
|
|
|
|
cv::Rect roi;
|
|
|
|
|
int j = 0; // 实际工作的相机标识,element_vec中可能有相机没在工作
|
|
|
|
|
for (int i = 0; i < element_vec.size(); i++)//每个相机的图轮流遍历
|
|
|
|
|
{
|
|
|
|
|
if (!SingleCamInfo[i].Detect || !SingleCamInfo[i].IsOpen || SingleCamInfo[i].OffLine)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
local_camera_number = i;
|
|
|
|
|
std::pair<int, cv::Mat> element;
|
|
|
|
|
element = element_vec[i];
|
|
|
|
@ -123,12 +113,6 @@ void SyncWorkThread::run()
|
|
|
|
|
#ifdef __TCPSend
|
|
|
|
|
_TCPSendInfo TCPSendInfo;
|
|
|
|
|
#endif
|
|
|
|
|
//#ifdef __TCPSend
|
|
|
|
|
// QString sendName = "416_BJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz");
|
|
|
|
|
// TCPSendInfo.pics_name = sendName.toLocal8Bit().constData();
|
|
|
|
|
// TCP_Info_queue->put(TCPSendInfo);
|
|
|
|
|
|
|
|
|
|
//#endif
|
|
|
|
|
if (!image.data)
|
|
|
|
|
{
|
|
|
|
|
continue; //图像为空,跳过
|
|
|
|
@ -137,7 +121,7 @@ void SyncWorkThread::run()
|
|
|
|
|
{
|
|
|
|
|
cv::cvtColor(image, image, CV_BGR2RGB); //灰度图像转为彩色图像
|
|
|
|
|
}
|
|
|
|
|
cv::resize(image, image, cv::Size(640, 512 * unit_count));
|
|
|
|
|
cv::resize(image, image, cv::Size(image_w, image_h * unit_count));
|
|
|
|
|
if (local_SysConf.shoot[local_camera_number] == unit_count)
|
|
|
|
|
{
|
|
|
|
|
std::vector<cv::Mat> vec_in;
|
|
|
|
@ -154,7 +138,6 @@ void SyncWorkThread::run()
|
|
|
|
|
}
|
|
|
|
|
vec_in.push_back(temp_image.clone());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<cv::Mat> vec_out;
|
|
|
|
|
std::vector<std::vector<std::pair<int, cv::Rect>>> vec_results;
|
|
|
|
|
QDateTime ts_start = QDateTime::currentDateTime();
|
|
|
|
@ -167,7 +150,9 @@ void SyncWorkThread::run()
|
|
|
|
|
vec_results.push_back(results);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
alg_jd[local_camera_number].detect_batch(vec_in, vec_out, vec_results);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
QDateTime ts_jd = QDateTime::currentDateTime();
|
|
|
|
|
int time_process = ts_start.msecsTo(ts_jd);
|
|
|
|
@ -343,7 +328,6 @@ void SyncWorkThread::run()
|
|
|
|
|
merge_index = j * unit_count + index + 1;
|
|
|
|
|
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)
|
|
|
|
@ -354,13 +338,15 @@ void SyncWorkThread::run()
|
|
|
|
|
{
|
|
|
|
|
ngReason = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//条盒TJ 小盒BJ
|
|
|
|
|
file_name = g_conf_path.save_pics_path + "/"
|
|
|
|
|
+ now_ts.toString("yyyy-MM-dd") + "/"+"416_TJ_01_"
|
|
|
|
|
+ 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 = "416_TJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz");
|
|
|
|
|
QString sendName = "416_BJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz");
|
|
|
|
|
TCPSendInfo.pics_name = sendName.toLocal8Bit().constData();
|
|
|
|
|
TCP_Info_queue->put(TCPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|