diff options
author | Luis de Bethencourt <luisbg@osg.samsung.com> | 2015-10-02 18:40:43 +0100 |
---|---|---|
committer | Luis de Bethencourt <luisbg@osg.samsung.com> | 2015-10-02 18:41:45 +0100 |
commit | e2709ed2ef3ffd80fd5db72d52e2df07f6337c1f (patch) | |
tree | fa24e58c2ff6732f9b406371e94a1d4ce0219c26 /ext | |
parent | ae55a537e6b4244be4bec086bb512bdb6cf8ac0a (diff) | |
download | gstreamer-plugins-bad-e2709ed2ef3ffd80fd5db72d52e2df07f6337c1f.tar.gz |
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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opencv/gstretinex.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/opencv/gstretinex.cpp b/ext/opencv/gstretinex.cpp index f897acec6..4a1ea4df2 100644 --- a/ext/opencv/gstretinex.cpp +++ b/ext/opencv/gstretinex.cpp @@ -65,10 +65,12 @@ #include <gst/gst.h> #include "gstretinex.h" #include <opencv2/imgproc/imgproc_c.h> +#include <opencv2/imgproc/imgproc.hpp> 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 */ |