From 6483ab8b65886465863584e8dcfee57084030b9c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 6 Apr 2018 14:16:54 +0300 Subject: [PATCH] FS-11097: [mod_cv] Add OpenCV 3.x support. --- src/mod/applications/mod_cv/mod_cv.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_cv/mod_cv.cpp b/src/mod/applications/mod_cv/mod_cv.cpp index b0ba33b974..b1b33ec5ca 100644 --- a/src/mod/applications/mod_cv/mod_cv.cpp +++ b/src/mod/applications/mod_cv/mod_cv.cpp @@ -35,9 +35,6 @@ #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" -using namespace std; -using namespace cv; - #include #include "highgui.h" @@ -48,9 +45,14 @@ using namespace cv; switch_loadable_module_interface_t *MODULE_INTERFACE; +SWITCH_BEGIN_EXTERN_C SWITCH_MODULE_LOAD_FUNCTION(mod_cv_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cv_shutdown); SWITCH_MODULE_DEFINITION(mod_cv, mod_cv_load, mod_cv_shutdown, NULL); +SWITCH_END_EXTERN_C + +using namespace std; +using namespace cv; static const int NCHANNELS = 3; @@ -559,7 +561,7 @@ static void parse_stats(struct detect_stats *stats, uint32_t size, uint64_t skip void detectAndDraw(cv_context_t *context) { double scale = 1; - Mat img(context->rawImage); + Mat img = cvarrToMat(context->rawImage); switch_mutex_lock(context->mutex); @@ -890,7 +892,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi int shape_w, shape_h; int cx, cy; - if (!overlay->png || context->overlay[i]->abs == POS_NONE && !context->detect_event && !context->shape[0].cx) { + if (!overlay->png || (context->overlay[i]->abs == POS_NONE && !context->detect_event && !context->shape[0].cx)) { continue; }