opencv/facedetect: fix the build with opencv 3.1.0

- add using namespace std; for std::vector
    - use the cpp header imgproc.hpp file for the cv::ellipse function instead of
      the C header
    - Mat no longer takes IplImage in it's constructors, use the cvarrtomat()
      function instead.

    Fixes a couple of build errors:

    gstfacedetect.cpp:140:30: error: ‘vector’ does not name a type
     structure_and_message (const vector < Rect > &rectangles, const gchar * name,
                                  ^~~~~~
    gstfacedetect.cpp:140:37: error: expected ‘,’ or ‘...’ before ‘<’ token
     structure_and_message (const vector < Rect > &rectangles, const gchar * name,
                                         ^
    gstfacedetect.cpp: In function ‘void structure_and_message(int)’:
    gstfacedetect.cpp:143:13: error: ‘rectangles’ was not declared in this scope
       Rect sr = rectangles[0];

    [...]

    gstfacedetect.cpp: In function ‘void
    gst_face_detect_run_detector(GstFaceDetect*, cv::CascadeClassifier*, gint, gint,
    cv::Rect, std::vector<cv::Rect_<int> >&)’:
    gstfacedetect.cpp:562:31: error: no matching function for call to
    ‘cv::Mat::Mat(IplImage*&, cv::Rect&)’
         Mat roi (filter->cvGray, r);

    [...]

    gstfacedetect.cpp: In function ‘GstFlowReturn
    gst_face_detect_transform_ip(GstOpencvVideoFilter*, GstBuffer*, IplImage*)’:
    gstfacedetect.cpp:594:44: error: no matching function for call to
    ‘cv::Mat::Mat(cv::Mat, bool)’
         Mat mtxOrg (cv::cvarrToMat (img), false);

    [...]

    gstfacedetect.cpp:734:79: error: ‘ellipse’ was not declared in this scope
             ellipse (mtxOrg, center, axes, 0, 0, 360, Scalar (cr, cg, cb), 3, 8,
    0);
This commit is contained in:
Matthew Waters 2016-05-14 17:05:45 +01:00 committed by Luis de Bethencourt
parent a118f6a635
commit 044ed50190

View file

@ -76,10 +76,14 @@
# include <config.h>
#endif
using namespace std;
#include <vector>
#include "gstfacedetect.h"
#include <opencv2/imgproc/imgproc_c.h>
#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_face_detect_debug);
#define GST_CAT_DEFAULT gst_face_detect_debug
@ -557,7 +561,7 @@ gst_face_detect_run_detector (GstFaceDetect * filter,
img_stddev = stddev.val[0];
}
if (img_stddev >= filter->min_stddev) {
Mat roi (filter->cvGray, r);
Mat roi (cv::cvarrToMat (filter->cvGray), r);
detector->detectMultiScale (roi, faces, filter->scale_factor,
filter->min_neighbors, filter->flags, cvSize (min_size_width,
min_size_height), cvSize (0, 0));
@ -589,7 +593,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
gboolean do_display = FALSE;
gboolean post_msg = FALSE;
Mat mtxOrg (img, false);
Mat mtxOrg (cv::cvarrToMat (img));
if (filter->display) {
if (gst_buffer_is_writable (buf)) {