diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index f7cd328..35143d6 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -2892,8 +2892,12 @@ void Cigarette::init_plc_value() void Cigarette::CreatWorkThread(int classid, int Num, Cigarette* classptr) { + int CamId = Num; #ifdef SYNC_CAMERA - sync_work_thread.init(g_image_sync_queue, g_result_queue[0]); +#ifdef IS_CAM_NG_OK_DATA_MERGED + CamId = 0; // 默认使用第一个相机的数据 +#endif + sync_work_thread.init(g_image_sync_queue, g_result_queue[CamId]); connect(&sync_work_thread, SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat))); connect(&sync_work_thread, SIGNAL(display_timecost(int, int)), classptr, SLOT(OnDisplayTimeCostHub(int, int))); connect(&sync_work_thread, SIGNAL(display_check_total(int, long)), classptr, SLOT(OnDisplayCheckNumberHub(int, long))); @@ -2902,18 +2906,18 @@ void Cigarette::CreatWorkThread(int classid, int Num, Cigarette* classptr) connect(&sync_work_thread, SIGNAL(event_ng(int)), classptr, SLOT(OnNGHub(int))); sync_work_thread.start_work(); #else - work_thread[Num].init(g_image_queue[Num], g_result_queue[Num], classid, Num); - connect(&work_thread[Num], SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat))); - connect(&work_thread[Num], SIGNAL(display_timecost(int, int)), classptr, SLOT(OnDisplayTimeCostHub(int, int))); - connect(&work_thread[Num], SIGNAL(display_check_total(int, long)), classptr, SLOT(OnDisplayCheckNumberHub(int, long))); - connect(&work_thread[Num], SIGNAL(display_jd_no(int, QString)), classptr, SLOT(OnDisplayJdNoHub(int, QString))); - connect(&work_thread[Num], SIGNAL(event_ok(int)), classptr, SLOT(OnOKHub(int))); - connect(&work_thread[Num], SIGNAL(event_ng(int)), classptr, SLOT(OnNGHub(int))); - work_thread[Num].start_work(); - - debug_thread[Num].init(g_debug_queue[Num], Num); - connect(&debug_thread[Num], SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat))); - debug_thread[Num].start_work(); + work_thread[CamId].init(g_image_queue[CamId], g_result_queue[CamId], classid, CamId); + connect(&work_thread[CamId], SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat))); + connect(&work_thread[CamId], SIGNAL(display_timecost(int, int)), classptr, SLOT(OnDisplayTimeCostHub(int, int))); + connect(&work_thread[CamId], SIGNAL(display_check_total(int, long)), classptr, SLOT(OnDisplayCheckNumberHub(int, long))); + connect(&work_thread[CamId], SIGNAL(display_jd_no(int, QString)), classptr, SLOT(OnDisplayJdNoHub(int, QString))); + connect(&work_thread[CamId], SIGNAL(event_ok(int)), classptr, SLOT(OnOKHub(int))); + connect(&work_thread[CamId], SIGNAL(event_ng(int)), classptr, SLOT(OnNGHub(int))); + work_thread[CamId].start_work(); + + debug_thread[CamId].init(g_debug_queue[CamId], CamId); + connect(&debug_thread[CamId], SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat))); + debug_thread[CamId].start_work(); #endif } diff --git a/Cigarette/common.h b/Cigarette/common.h index e76a790..2c35598 100644 --- a/Cigarette/common.h +++ b/Cigarette/common.h @@ -33,6 +33,7 @@ //#define identify_Hik_YSXID//识别海康相机YSXID //#define DRAW_RECT // 鼠标画框功能 #define SYNC_CAMERA //相机同步处理图片 +#define IS_CAM_NG_OK_DATA_MERGED //合并相机NG/OK数据 #define Queue_Size 15 #define Unit_Queue_Size Queue_Size*3