From e2709ed2ef3ffd80fd5db72d52e2df07f6337c1f Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 2 Oct 2015 18:40:43 +0100 Subject: [PATCH] retinex: use OpenCV namespace As part of the switch to C++, use the new OpenCV functions. https://bugzilla.gnome.org/show_bug.cgi?id=754148 --- ext/opencv/gstretinex.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/opencv/gstretinex.cpp b/ext/opencv/gstretinex.cpp index f897acec6e..4a1ea4df27 100644 --- a/ext/opencv/gstretinex.cpp +++ b/ext/opencv/gstretinex.cpp @@ -65,10 +65,12 @@ #include #include "gstretinex.h" #include +#include GST_DEBUG_CATEGORY_STATIC (gst_retinex_debug); #define GST_CAT_DEFAULT gst_retinex_debug +using namespace cv; /* Filter signals and args */ enum { @@ -153,12 +155,13 @@ gst_retinex_class_init (GstRetinexClass * klass) "Retinex method to use", "Retinex method to use", GST_TYPE_RETINEX_METHOD, DEFAULT_METHOD, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (gobject_class, PROP_SCALES, g_param_spec_int ("scales", "scales", "Amount of gaussian filters (scales) used in multiscale retinex", 1, - 4, DEFAULT_SCALES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + 4, DEFAULT_SCALES, + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); gst_element_class_set_static_metadata (element_class, "Retinex image colour enhacement", "Filter/Effect/Video", @@ -169,10 +172,8 @@ gst_retinex_class_init (GstRetinexClass * klass) gst_static_pad_template_get (&src_factory)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_factory)); - } - /* initialize the new element * instantiate pads and add them to element * set pad calback functions @@ -294,8 +295,9 @@ gst_retinex_transform_ip (GstBaseTransform * btrans, GstBuffer * buf) int gain = 128; int offset = 128; int filter_size; + Mat icvD (retinex->cvD, false); - if (!gst_buffer_map (buf, &info, GST_MAP_READWRITE)) { + if (!gst_buffer_map (buf, &info, (GstMapFlags) GST_MAP_READWRITE)) { return GST_FLOW_ERROR; } retinex->cvRGBin->imageData = (char *) info.data; @@ -314,8 +316,7 @@ gst_retinex_transform_ip (GstBaseTransform * btrans, GstBuffer * buf) filter_size = filter_size * 2 + 1; cvConvert (retinex->cvRGBin, retinex->cvD); - cvSmooth (retinex->cvD, retinex->cvD, CV_GAUSSIAN, filter_size, filter_size, - 0.0, 0.0); + GaussianBlur (icvD, icvD, Size (filter_size, filter_size), 0.0, 0.0); cvLog (retinex->cvD, retinex->cvC); /* Compute difference */ @@ -360,8 +361,7 @@ gst_retinex_transform_ip (GstBaseTransform * btrans, GstBuffer * buf) filter_size = filter_size * 2 + 1; cvConvert (retinex->cvRGBin, retinex->cvD); - cvSmooth (retinex->cvD, retinex->cvD, CV_GAUSSIAN, filter_size, - filter_size, 0.0, 0.0); + GaussianBlur (icvD, icvD, Size (filter_size, filter_size), 0.0, 0.0); cvLog (retinex->cvD, retinex->cvC); /* Compute weighted difference */