opencv: faceblur: Ported to OpenCV version 3.1

cvarrToMat() is added because it is compatible with all versions of Opencv
and the use of the class constructor Mat is eliminated because is deprecated
in 3.X versions. Included 'using namespace std' because it is needed for the
Vector class in 3.X versions. This keeps compatibility with 2.4.

https://bugzilla.gnome.org/show_bug.cgi?id=760473
This commit is contained in:
Vanessa Chipirras Navalon 2016-01-27 15:37:39 +01:00 committed by Luis de Bethencourt
parent 93b83edfe5
commit 120f32fed4

View file

@ -80,6 +80,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_face_blur_debug);
#define DEFAULT_MIN_SIZE_HEIGHT 30
using namespace cv;
using namespace std;
enum
{
PROP_0,
@ -355,9 +356,7 @@ gst_face_blur_transform_ip (GstOpencvVideoFilter * transform,
cvCvtColor (img, filter->cvGray, CV_RGB2GRAY);
Mat image (filter->cvGray, Rect (filter->cvGray->origin,
filter->cvGray->origin, filter->cvGray->width,
filter->cvGray->height));
Mat image = cvarrToMat(filter->cvGray);
filter->cvCascade->detectMultiScale (image, faces, filter->scale_factor,
filter->min_neighbors, filter->flags,
cvSize (filter->min_size_width, filter->min_size_height), cvSize (0, 0));
@ -366,7 +365,8 @@ gst_face_blur_transform_ip (GstOpencvVideoFilter * transform,
for (i = 0; i < faces.size (); ++i) {
Rect *r = &faces[i];
Mat roi (img, Rect (r->x, r->y, r->width, r->height));
Mat imag = cvarrToMat(img);
Mat roi (imag, Rect (r->x, r->y, r->width, r->height));
blur (roi, roi, Size (11, 11));
GaussianBlur (roi, roi, Size (11, 11), 0, 0);
}