添加相机NG/OK数据合并和分开处理的宏,默认合并处理

CigaretteSH
Flamingo 6 months ago
parent f0e12c5d1d
commit eef068972b

@ -2892,8 +2892,12 @@ void Cigarette::init_plc_value()
void Cigarette::CreatWorkThread(int classid, int Num, Cigarette* classptr) void Cigarette::CreatWorkThread(int classid, int Num, Cigarette* classptr)
{ {
int CamId = Num;
#ifdef SYNC_CAMERA #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(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_timecost(int, int)), classptr, SLOT(OnDisplayTimeCostHub(int, int)));
connect(&sync_work_thread, SIGNAL(display_check_total(int, long)), classptr, SLOT(OnDisplayCheckNumberHub(int, long))); 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))); connect(&sync_work_thread, SIGNAL(event_ng(int)), classptr, SLOT(OnNGHub(int)));
sync_work_thread.start_work(); sync_work_thread.start_work();
#else #else
work_thread[Num].init(g_image_queue[Num], g_result_queue[Num], classid, Num); work_thread[CamId].init(g_image_queue[CamId], g_result_queue[CamId], classid, CamId);
connect(&work_thread[Num], SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat))); connect(&work_thread[CamId], 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[CamId], 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[CamId], 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[CamId], 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[CamId], SIGNAL(event_ok(int)), classptr, SLOT(OnOKHub(int)));
connect(&work_thread[Num], SIGNAL(event_ng(int)), classptr, SLOT(OnNGHub(int))); connect(&work_thread[CamId], SIGNAL(event_ng(int)), classptr, SLOT(OnNGHub(int)));
work_thread[Num].start_work(); work_thread[CamId].start_work();
debug_thread[Num].init(g_debug_queue[Num], Num); debug_thread[CamId].init(g_debug_queue[CamId], CamId);
connect(&debug_thread[Num], SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat))); connect(&debug_thread[CamId], SIGNAL(notify(int, int, cv::Mat)), classptr, SLOT(OnNotifyHub(int, int, cv::Mat)));
debug_thread[Num].start_work(); debug_thread[CamId].start_work();
#endif #endif
} }

@ -33,6 +33,7 @@
//#define identify_Hik_YSXID//识别海康相机YSXID //#define identify_Hik_YSXID//识别海康相机YSXID
//#define DRAW_RECT // 鼠标画框功能 //#define DRAW_RECT // 鼠标画框功能
#define SYNC_CAMERA //相机同步处理图片 #define SYNC_CAMERA //相机同步处理图片
#define IS_CAM_NG_OK_DATA_MERGED //合并相机NG/OK数据
#define Queue_Size 15 #define Queue_Size 15
#define Unit_Queue_Size Queue_Size*3 #define Unit_Queue_Size Queue_Size*3

Loading…
Cancel
Save