mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
opencv: make work with openCV 2.2
https://bugzilla.gnome.org/show_bug.cgi?id=641796
This commit is contained in:
parent
1da68c5e82
commit
7e5c7048d6
7 changed files with 44 additions and 17 deletions
|
@ -1272,7 +1272,7 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
|
||||||
dnl a new version and the no-backward-compatibility define. (There doesn't
|
dnl a new version and the no-backward-compatibility define. (There doesn't
|
||||||
dnl seem to be a switch to suppress the warnings the cvcompat.h header
|
dnl seem to be a switch to suppress the warnings the cvcompat.h header
|
||||||
dnl causes.)
|
dnl causes.)
|
||||||
PKG_CHECK_MODULES(OPENCV, opencv >= 2.0.0 opencv <= 2.1.0 , [
|
PKG_CHECK_MODULES(OPENCV, opencv >= 2.0.0 opencv <= 2.2.0 , [
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CPLUSPLUS
|
||||||
OLD_CPPFLAGS=$CPPFLAGS
|
OLD_CPPFLAGS=$CPPFLAGS
|
||||||
|
|
|
@ -269,7 +269,11 @@ gst_faceblur_chain (GstPad * pad, GstBuffer * buf)
|
||||||
if (filter->cvCascade) {
|
if (filter->cvCascade) {
|
||||||
faces =
|
faces =
|
||||||
cvHaarDetectObjects (filter->cvGray, filter->cvCascade,
|
cvHaarDetectObjects (filter->cvGray, filter->cvCascade,
|
||||||
filter->cvStorage, 1.1, 2, 0, cvSize (30, 30));
|
filter->cvStorage, 1.1, 2, 0, cvSize (30, 30)
|
||||||
|
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2)
|
||||||
|
, cvSize (32, 32)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
if (faces && faces->total > 0) {
|
if (faces && faces->total > 0) {
|
||||||
buf = gst_buffer_make_writable (buf);
|
buf = gst_buffer_make_writable (buf);
|
||||||
|
|
|
@ -49,6 +49,10 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <cv.h>
|
#include <cv.h>
|
||||||
|
|
||||||
|
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2)
|
||||||
|
#include <opencv2/objdetect/objdetect.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
/* #defines don't like whitespacey bits */
|
/* #defines don't like whitespacey bits */
|
||||||
#define GST_TYPE_FACEBLUR \
|
#define GST_TYPE_FACEBLUR \
|
||||||
|
|
|
@ -408,8 +408,11 @@ gst_facedetect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
|
||||||
faces =
|
faces =
|
||||||
cvHaarDetectObjects (filter->cvGray, filter->cvCascade,
|
cvHaarDetectObjects (filter->cvGray, filter->cvCascade,
|
||||||
filter->cvStorage, filter->scale_factor, filter->min_neighbors,
|
filter->cvStorage, filter->scale_factor, filter->min_neighbors,
|
||||||
filter->flags,
|
filter->flags, cvSize (filter->min_size_width, filter->min_size_height)
|
||||||
cvSize (filter->min_size_width, filter->min_size_height));
|
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2)
|
||||||
|
, cvSize (filter->min_size_width + 2, filter->min_size_height + 2)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
if (faces && faces->total > 0) {
|
if (faces && faces->total > 0) {
|
||||||
msg = gst_facedetect_message_new (filter, buf);
|
msg = gst_facedetect_message_new (filter, buf);
|
||||||
|
|
|
@ -50,6 +50,10 @@
|
||||||
#include <cv.h>
|
#include <cv.h>
|
||||||
#include "gstopencvvideofilter.h"
|
#include "gstopencvvideofilter.h"
|
||||||
|
|
||||||
|
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2)
|
||||||
|
#include <opencv2/objdetect/objdetect.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
/* #defines don't like whitespacey bits */
|
/* #defines don't like whitespacey bits */
|
||||||
#define GST_TYPE_FACEDETECT \
|
#define GST_TYPE_FACEDETECT \
|
||||||
|
|
|
@ -162,7 +162,7 @@ gst_templatematch_class_init (GstTemplateMatchClass * klass)
|
||||||
|
|
||||||
/* initialize the new element
|
/* initialize the new element
|
||||||
* instantiate pads and add them to element
|
* instantiate pads and add them to element
|
||||||
* set pad calback functions
|
* set pad callback functions
|
||||||
* initialize instance structure
|
* initialize instance structure
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -315,9 +315,21 @@ gst_templatematch_chain (GstPad * pad, GstBuffer * buf)
|
||||||
if ((!filter) || (!buf) || filter->template == NULL) {
|
if ((!filter) || (!buf) || filter->template == NULL) {
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
GST_DEBUG_OBJECT (filter, "Buffer size %u ", GST_BUFFER_SIZE (buf));
|
||||||
|
|
||||||
filter->cvImage->imageData = (char *) GST_BUFFER_DATA (buf);
|
filter->cvImage->imageData = (char *) GST_BUFFER_DATA (buf);
|
||||||
|
|
||||||
if (!filter->cvDistImage) {
|
if (!filter->cvDistImage) {
|
||||||
|
if (filter->cvTemplateImage->width > filter->cvImage->width) {
|
||||||
|
GST_WARNING ("Template Image is wider than input image");
|
||||||
|
} else if (filter->cvTemplateImage->height > filter->cvImage->height) {
|
||||||
|
GST_WARNING ("Template Image is taller than input image");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (filter, "cvCreateImage (Size(%d-%d+1,%d) %d, %d)",
|
||||||
|
filter->cvImage->width, filter->cvTemplateImage->width,
|
||||||
|
filter->cvImage->height - filter->cvTemplateImage->height + 1,
|
||||||
|
IPL_DEPTH_32F, 1);
|
||||||
filter->cvDistImage =
|
filter->cvDistImage =
|
||||||
cvCreateImage (cvSize (filter->cvImage->width -
|
cvCreateImage (cvSize (filter->cvImage->width -
|
||||||
filter->cvTemplateImage->width + 1,
|
filter->cvTemplateImage->width + 1,
|
||||||
|
@ -327,7 +339,8 @@ gst_templatematch_chain (GstPad * pad, GstBuffer * buf)
|
||||||
GST_WARNING ("Couldn't create dist image.");
|
GST_WARNING ("Couldn't create dist image.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (filter->cvTemplateImage) {
|
}
|
||||||
|
if (filter->cvTemplateImage && filter->cvImage && filter->cvDistImage) {
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
GstMessage *m;
|
GstMessage *m;
|
||||||
|
|
||||||
|
@ -389,8 +402,10 @@ gst_templatematch_load_template (GstTemplateMatch * filter)
|
||||||
if (filter->template) {
|
if (filter->template) {
|
||||||
filter->cvTemplateImage =
|
filter->cvTemplateImage =
|
||||||
cvLoadImage (filter->template, CV_LOAD_IMAGE_COLOR);
|
cvLoadImage (filter->template, CV_LOAD_IMAGE_COLOR);
|
||||||
|
|
||||||
if (!filter->cvTemplateImage) {
|
if (!filter->cvTemplateImage) {
|
||||||
GST_WARNING ("Couldn't load template image: %s.", filter->template);
|
GST_WARNING ("Couldn't load template image: %s. error: %s",
|
||||||
|
filter->template, g_strerror (errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,9 +47,6 @@
|
||||||
#define __GST_OPENCV_TEXT_OVERLAY_H__
|
#define __GST_OPENCV_TEXT_OVERLAY_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <cv.h>
|
|
||||||
#include <cvaux.h>
|
|
||||||
#include <highgui.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue