opencv: clean includes

The opencv element includes were full of duplicates and uneeded headers.
For example a few elements that stopped using gstcvopencvutils still
included that header file.
This commit is contained in:
Luis de Bethencourt 2015-12-12 20:07:32 +00:00
parent 892d8d515f
commit 447c1b1395
36 changed files with 151 additions and 220 deletions

View file

@ -45,8 +45,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstcvdilate.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -50,8 +50,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstcvdilateerode.h"

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -44,8 +44,6 @@
#ifndef __GST_CV_DILATE_ERODE_H__
#define __GST_CV_DILATE_ERODE_H__
#include <gst/gst.h>
#include <gstopencvvideofilter.h>
G_BEGIN_DECLS
@ -72,7 +70,7 @@ struct _GstCvDilateErode
gint iterations;
};
struct _GstCvDilateErodeClass
struct _GstCvDilateErodeClass
{
GstOpencvVideoFilterClass parent_class;
};

View file

@ -45,9 +45,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstcvequalizehist.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -44,8 +44,6 @@
#ifndef __GST_CV_EQUALIZE_HIST_H__
#define __GST_CV_EQUALIZE_HIST_H__
#include <gst/gst.h>
#include <gstopencvvideofilter.h>
G_BEGIN_DECLS
@ -70,7 +68,7 @@ struct _GstCvEqualizeHist
GstOpencvVideoFilter element;
};
struct _GstCvEqualizeHistClass
struct _GstCvEqualizeHistClass
{
GstOpencvVideoFilterClass parent_class;
};

View file

@ -45,8 +45,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstcverode.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -45,9 +45,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstcvlaplace.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -44,8 +44,6 @@
#ifndef __GST_CV_LAPLACE_H__
#define __GST_CV_LAPLACE_H__
#include <gst/gst.h>
#include <gstopencvvideofilter.h>
G_BEGIN_DECLS
@ -76,7 +74,7 @@ struct _GstCvLaplace
IplImage *intermediary_img;
};
struct _GstCvLaplaceClass
struct _GstCvLaplaceClass
{
GstOpencvVideoFilterClass parent_class;
};

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -45,8 +45,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstcvsmooth.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -44,8 +44,6 @@
#ifndef __GST_CV_SMOOTH_H__
#define __GST_CV_SMOOTH_H__
#include <gst/gst.h>
#include <gstopencvvideofilter.h>
G_BEGIN_DECLS
@ -77,7 +75,7 @@ struct _GstCvSmooth
gdouble spatialsigma;
};
struct _GstCvSmoothClass
struct _GstCvSmoothClass
{
GstOpencvVideoFilterClass parent_class;
};

View file

@ -45,9 +45,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstcvsobel.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -44,8 +44,6 @@
#ifndef __GST_CV_SOBEL_H__
#define __GST_CV_SOBEL_H__
#include <gst/gst.h>
#include <gstopencvvideofilter.h>
G_BEGIN_DECLS
@ -74,7 +72,7 @@ struct _GstCvSobel
gint aperture_size;
};
struct _GstCvSobelClass
struct _GstCvSobelClass
{
GstOpencvVideoFilterClass parent_class;
};

View file

@ -53,32 +53,32 @@
* run prefiltering stages to normalize brightness between the inputs, and to maximize texture.
*
* Note that in general is hard to find correspondences between soft textures, for instance a
* block of gloss blue colour. The output is a gray image with values close to white meaning
* block of gloss blue colour. The output is a gray image with values close to white meaning
* closer to the cameras and darker far away. Black means that the pixels were not matched
* correctly (not found). The resulting depth map can be transformed into real world coordinates
* by means of OpenCV function (reprojectImageTo3D) but for this the camera matrixes need to
* be fully known.
*
* Algorithm 1 is the OpenCV Stereo Block Matching, similar to the one developed by Kurt Konolige
* [A] and that works by using small Sum-of-absolute-differenc (SAD) windows to find matching
* [A] and that works by using small Sum-of-absolute-differenc (SAD) windows to find matching
* points between the left and right rectified images. This algorithm finds only strongly matching
* points between both images, this means normally strong textures. In soft textures, such as a
* single coloured wall (as opposed to, f.i. a hairy rug), not all pixels might have correspondence.
*
* Algorithm 2 is the Semi Global Matching (SGM) algorithm [B] which models the scene structure
* with a point-wise matching cost and an associated smoothness term. The energy minimization
* is then computed in a multitude of 1D lines. For each point, the disparity corresponding to
* the minimum aggregated cost is selected. In [B] the author proposes to use 8 or 16 different
* independent paths. The SGM approach works well near depth discontinuities, but produces less
* accurate results. Despite its relatively large memory footprint, this method is very fast and
* with a point-wise matching cost and an associated smoothness term. The energy minimization
* is then computed in a multitude of 1D lines. For each point, the disparity corresponding to
* the minimum aggregated cost is selected. In [B] the author proposes to use 8 or 16 different
* independent paths. The SGM approach works well near depth discontinuities, but produces less
* accurate results. Despite its relatively large memory footprint, this method is very fast and
* potentially robust to complicated textured regions.
*
* Algorithm 3 is the OpenCV implementation of a modification of the variational stereo
* Algorithm 3 is the OpenCV implementation of a modification of the variational stereo
* correspondence algorithm, described in [C].
*
* Algorithm 4 is the Graph Cut stereo vision algorithm (GC) introduced in [D]; it is a global
* Algorithm 4 is the Graph Cut stereo vision algorithm (GC) introduced in [D]; it is a global
* stereo vision method. It calculates depth discontinuities by minimizing an energy function
* combingin a point-wise matching cost and a smoothness term. The energy function is passed
* combingin a point-wise matching cost and a smoothness term. The energy function is passed
* to graph and Graph Cut is used to find a lowest-energy cut. GC is computationally intensive due
* to its global nature and uses loads of memory, but it can deal with textureless regions and
* reflections better than other methods.
@ -86,15 +86,15 @@
*
* Some test images can be found here: http://vision.stanford.edu/~birch/p2p/
*
* [A] K. Konolige. Small vision system. hardware and implementation. In Proc. International
* [A] K. Konolige. Small vision system. hardware and implementation. In Proc. International
* Symposium on Robotics Research, pages 111--116, Hayama, Japan, 1997.
* [B] H. Hirschmüller, Accurate and efficient stereo processing by semi-global matching and
* mutual information, in Proceedings of the IEEE Conference on Computer Vision and Pattern
* [B] H. Hirschmüller, Accurate and efficient stereo processing by semi-global matching and
* mutual information, in Proceedings of the IEEE Conference on Computer Vision and Pattern
* Recognition, 2005, pp. 807814.
* [C] S. Kosov, T. Thormaehlen, H.-P. Seidel "Accurate Real-Time Disparity Estimation with
* Variational Methods" Proceedings of the 5th International Symposium on Visual Computing,
* Variational Methods" Proceedings of the 5th International Symposium on Visual Computing,
* Vegas, USA
* [D] Scharstein, D. & Szeliski, R. (2001). A taxonomy and evaluation of dense two-frame stereo
* [D] Scharstein, D. & Szeliski, R. (2001). A taxonomy and evaluation of dense two-frame stereo
* correspondence algorithms, International Journal of Computer Vision 47: 742.
*
* <refsect2>
@ -103,7 +103,7 @@
* gst-launch-1.0 videotestsrc ! video/x-raw,width=320,height=240 ! disp0.sink_right videotestsrc ! video/x-raw,width=320,height=240 ! disp0.sink_left disparity name=disp0 ! videoconvert ! ximagesink
* ]|
* Another example, with two png files representing a classical stereo matching,
* downloadable from http://vision.middlebury.edu/stereo/submit/tsukuba/im4.png and
* downloadable from http://vision.middlebury.edu/stereo/submit/tsukuba/im4.png and
* im3.png. Note here they are downloaded in ~ (home).
* |[
gst-launch-1.0 multifilesrc location=~/im3.png ! pngdec ! videoconvert ! disp0.sink_right multifilesrc location=~/im4.png ! pngdec ! videoconvert ! disp0.sink_left disparity name=disp0 method=sbm disp0.src ! videoconvert ! ximagesink
@ -119,8 +119,6 @@ gst-launch-1.0 multifilesrc location=~/im3.png ! pngdec ! videoconvert ! di
#include <config.h>
#endif
#include <gst/gst.h>
#include <gst/video/video.h>
#include <opencv2/contrib/contrib.hpp>
#include "gstdisparity.h"
@ -548,19 +546,19 @@ gst_disparity_chain_right (GstPad * pad, GstObject * parent, GstBuffer * buffer)
fs->width, fs->height, fs->actualChannels);
/* Stereo corresponding using semi-global block matching. According to OpenCV:
"" The class implements modified H. Hirschmuller algorithm HH08 . The main
"" The class implements modified H. Hirschmuller algorithm HH08 . The main
differences between the implemented algorithm and the original one are:
- by default the algorithm is single-pass, i.e. instead of 8 directions we
- by default the algorithm is single-pass, i.e. instead of 8 directions we
only consider 5. Set fullDP=true to run the full variant of the algorithm
(which could consume a lot of memory)
- the algorithm matches blocks, not individual pixels (though, by setting
SADWindowSize=1 the blocks are reduced to single pixels)
- mutual information cost function is not implemented. Instead, we use a
simpler Birchfield-Tomasi sub-pixel metric from BT96 , though the color
simpler Birchfield-Tomasi sub-pixel metric from BT96 , though the color
images are supported as well.
- we include some pre- and post- processing steps from K. Konolige
algorithm FindStereoCorrespondenceBM , such as pre-filtering
- we include some pre- and post- processing steps from K. Konolige
algorithm FindStereoCorrespondenceBM , such as pre-filtering
( CV_STEREO_BM_XSOBEL type) and post-filtering (uniqueness check, quadratic
interpolation and speckle filtering) ""
*/
@ -572,7 +570,7 @@ gst_disparity_chain_right (GstPad * pad, GstObject * parent, GstBuffer * buffer)
CV_MINMAX, NULL);
cvCvtColor (fs->cvGray_depth_map2, fs->cvRGB_right, CV_GRAY2RGB);
}
/* Algorithm 1 is the OpenCV Stereo Block Matching, similar to the one
/* Algorithm 1 is the OpenCV Stereo Block Matching, similar to the one
developed by Kurt Konolige [A] and that works by using small Sum-of-absolute-
differences (SAD) window. See the comments on top of the file.
*/
@ -593,9 +591,9 @@ gst_disparity_chain_right (GstPad * pad, GstObject * parent, GstBuffer * buffer)
run_svar_iteration (fs);
cvCvtColor (fs->cvGray_depth_map2, fs->cvRGB_right, CV_GRAY2RGB);
}
/* The Graph Cut stereo vision algorithm (GC) introduced in [D] is a global
stereo vision method. It calculates depth discontinuities by minimizing an
energy function combingin a point-wise matching cost and a smoothness term.
/* The Graph Cut stereo vision algorithm (GC) introduced in [D] is a global
stereo vision method. It calculates depth discontinuities by minimizing an
energy function combingin a point-wise matching cost and a smoothness term.
See the comments on top of the file.
*/
else if (METHOD_GC == fs->method) {

View file

@ -45,6 +45,7 @@
#define __GST_DISPARITY_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <opencv2/legacy/legacy.hpp>

View file

@ -3,7 +3,7 @@
* Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -60,9 +60,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstedgedetect.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -3,7 +3,7 @@
* Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -47,6 +47,7 @@
#define __GST_EDGE_DETECT_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <opencv2/core/core_c.h>
G_BEGIN_DECLS

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
* Copyright (C) 2011 Robert Jobbagy <jobbagy.robert@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -61,10 +61,8 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include <vector>
#include "gstopencvutils.h"
#include "gstfaceblur.h"
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/imgproc/imgproc.hpp>

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
* Copyright (C) 2011 Robert Jobbagy <jobbagy.robert@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation

View file

@ -76,11 +76,8 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include <gst/video/gstvideometa.h>
#include <vector>
#include "gstopencvutils.h"
#include "gstfacedetect.h"
#include <opencv2/imgproc/imgproc_c.h>
@ -573,7 +570,7 @@ gst_face_detect_run_detector (GstFaceDetect * filter,
}
}
/*
/*
* Performs the face detection
*/
static GstFlowReturn

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2013 Miguel Casas-Sanchez <miguelecasassanchez@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -48,23 +48,23 @@
* This element is a wrapper around OpenCV grabcut implementation. GrabCut is an
* image segmentation method based on graph cuts technique. It can be seen as a
* way of fine-grain segmenting the image from some FG and BG "seed" areas. The
* OpenCV implementation follows the article [1].
* OpenCV implementation follows the article [1].
* The "seed" areas are taken in this element from either an input bounding box
* coming from a face detection, or from alpha channel values. The input box is
* taken from a "face" event such as the one generated from the 'facedetect'
* element. The Alpha channel values should be one of the following (cv.hpp):
* enum{
* taken from a "face" event such as the one generated from the 'facedetect'
* element. The Alpha channel values should be one of the following (cv.hpp):
* enum{
* GC_BGD = 0, //!< background
* GC_FGD = 1, //!< foreground
* GC_PR_BGD = 2, //!< most probably background
* GC_PR_FGD = 3 //!< most probably foreground
* };
* with values over GC_PR_FGD interpreted as GC_PR_FGD. IN CASE OF no alpha mask
* input (all 0's or all 1's), the 'GstOpenCvFaceDetect-face' downstream event
* input (all 0's or all 1's), the 'GstOpenCvFaceDetect-face' downstream event
* is used to create a bbox of PR_FG elements. If both foreground alpha
* is not specified and there is no face detection, nothing is done.
*
* [1] C. Rother, V. Kolmogorov, and A. Blake, "GrabCut: Interactive foreground
* [1] C. Rother, V. Kolmogorov, and A. Blake, "GrabCut: Interactive foreground
* extraction using iterated graph cuts, ACM Trans. Graph., vol. 23, pp. 309314,
* 2004.
*
@ -84,11 +84,9 @@
#include <config.h>
#endif
#include <gst/gst.h>
#include "gstgrabcut.h"
extern "C"
{
#include <gst/video/gstvideometa.h>
#include <opencv2/imgproc/imgproc_c.h>
}
#include <opencv2/imgproc/imgproc.hpp>
@ -326,8 +324,8 @@ gst_grabcut_transform_ip (GstVideoFilter * btrans, GstVideoFrame * frame)
cvCvtColor (gc->cvRGBAin, gc->cvRGBin, CV_BGRA2BGR);
compose_matrix_from_image (gc->grabcut_mask, gc->cvD);
/* Pass cvD to grabcut_mask for the graphcut stuff but that only if
really there is something in the mask! otherwise -->input bbox is
/* Pass cvD to grabcut_mask for the graphcut stuff but that only if
really there is something in the mask! otherwise -->input bbox is
what we use */
alphapixels = cvCountNonZero (gc->cvD);
if ((0 < alphapixels) && (alphapixels < (gc->width * gc->height))) {

View file

@ -62,7 +62,6 @@
/* element header */
#include "gsthanddetect.h"
#include "gstopencvutils.h"
#include <opencv2/imgproc/imgproc_c.h>
GST_DEBUG_CATEGORY_STATIC (gst_handdetect_debug);

View file

@ -45,10 +45,6 @@
#ifndef __GST_HANDDETECT_H__
#define __GST_HANDDETECT_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/navigation.h>
#include <cv.h>
#include "gstopencvvideofilter.h"

View file

@ -59,15 +59,7 @@
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <limits.h>
#include <glib.h>
#include "gstmotioncells.h"
#include <gst/video/video.h>
GST_DEBUG_CATEGORY_STATIC (gst_motion_cells_debug);
#define GST_CAT_DEFAULT gst_motion_cells_debug

View file

@ -2,7 +2,7 @@
* GStreamer
* Copyright (C) 2011 Robert Jobbagy <jobbagy.robert@gmail.com>
* Copyright (C) 2011 Nicola Murino <nicola.murino@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -46,6 +46,7 @@
#define __GST_MOTIONCELLS_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <opencv2/core/core_c.h>
#include "motioncells_wrapper.h"

View file

@ -47,8 +47,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvvideofilter.h"
#include "gstopencvutils.h"

View file

@ -60,9 +60,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstpyramidsegment.h"
#define BLOCK_SIZE 1000

View file

@ -3,7 +3,7 @@
* Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -47,6 +47,7 @@
#define __GST_PYRAMID_SEGMENT_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <opencv2/core/version.hpp>
#if CV_MAJOR_VERSION * 100 + CV_MINOR_VERSION >= 204

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2013 Miguel Casas-Sanchez <miguelecasassanchez@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -46,8 +46,8 @@
*
* Basic and multiscale retinex for colour image enhancement, see article:
*
* Rahman, Zia-ur, Daniel J. Jobson, and Glenn A. Woodell. "Multi-scale retinex for
* color image enhancement." Image Processing, 1996. Proceedings., International
* Rahman, Zia-ur, Daniel J. Jobson, and Glenn A. Woodell. "Multi-scale retinex for
* color image enhancement." Image Processing, 1996. Proceedings., International
* Conference on. Vol. 3. IEEE, 1996.
*
* <refsect2>
@ -62,7 +62,6 @@
#include <config.h>
#endif
#include <gst/gst.h>
#include "gstretinex.h"
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/imgproc/imgproc.hpp>
@ -304,7 +303,7 @@ gst_retinex_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
/* Basic retinex restoration. The image and a filtered image are converted
to the log domain and subtracted.
O = Log(I) - Log(H(I))
O = Log(I) - Log(H(I))
where O is the output, H is a gaussian 2d filter and I is the input image. */
if (METHOD_BASIC == retinex->method) {
/* Compute log image */

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2013 Miguel Casas-Sanchez <miguelecasassanchez@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -44,9 +44,6 @@
#ifndef __GST_RETINEX_H__
#define __GST_RETINEX_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
#include <opencv2/core/core_c.h>
#include <gstopencvvideofilter.h>

View file

@ -1,15 +1,15 @@
/*
* GStreamer
* Copyright (C) 2013 Miguel Casas-Sanchez <miguelecasassanchez@gmail.com>
* Except: Parts of code inside the preprocessor define CODE_FROM_OREILLY_BOOK,
* which are downloaded from O'Reilly website
* Except: Parts of code inside the preprocessor define CODE_FROM_OREILLY_BOOK,
* which are downloaded from O'Reilly website
* [http://examples.oreilly.com/9780596516130/]
* and adapted. Its license reads:
* "Oct. 3, 2008
* Right to use this code in any way you want without warrenty, support or
* Right to use this code in any way you want without warrenty, support or
* any guarentee of it working. "
*
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -55,27 +55,27 @@
*
* This element creates and updates a fg/bg model using one of several approaches.
* The one called "codebook" refers to the codebook approach following the opencv
* O'Reilly book [1] implementation of the algorithm described in K. Kim,
* T. H. Chalidabhongse, D. Harwood and L. Davis [2]. BackgroundSubtractorMOG [3],
* or MOG for shorts, refers to a Gaussian Mixture-based Background/Foreground
* O'Reilly book [1] implementation of the algorithm described in K. Kim,
* T. H. Chalidabhongse, D. Harwood and L. Davis [2]. BackgroundSubtractorMOG [3],
* or MOG for shorts, refers to a Gaussian Mixture-based Background/Foreground
* Segmentation Algorithm. OpenCV MOG implements the algorithm described in [4].
* BackgroundSubtractorMOG2 [5], refers to another Gaussian Mixture-based
* Background/Foreground segmentation algorithm. OpenCV MOG2 implements the
* BackgroundSubtractorMOG2 [5], refers to another Gaussian Mixture-based
* Background/Foreground segmentation algorithm. OpenCV MOG2 implements the
* algorithm described in [6] and [7].
*
* [1] Learning OpenCV: Computer Vision with the OpenCV Library by Gary Bradski
* [1] Learning OpenCV: Computer Vision with the OpenCV Library by Gary Bradski
* and Adrian Kaehler, Published by O'Reilly Media, October 3, 2008
* [2] "Real-time Foreground-Background Segmentation using Codebook Model",
* [2] "Real-time Foreground-Background Segmentation using Codebook Model",
* Real-time Imaging, Volume 11, Issue 3, Pages 167-256, June 2005.
* [3] http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractormog
* [4] P. KadewTraKuPong and R. Bowden, "An improved adaptive background
* mixture model for real-time tracking with shadow detection", Proc. 2nd
* [4] P. KadewTraKuPong and R. Bowden, "An improved adaptive background
* mixture model for real-time tracking with shadow detection", Proc. 2nd
* European Workshop on Advanced Video-Based Surveillance Systems, 2001
* [5] http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractormog2
* [6] Z.Zivkovic, "Improved adaptive Gausian mixture model for background
* [6] Z.Zivkovic, "Improved adaptive Gausian mixture model for background
* subtraction", International Conference Pattern Recognition, UK, August, 2004.
* [7] Z.Zivkovic, F. van der Heijden, "Efficient Adaptive Density Estimation
* per Image Pixel for the Task of Background Subtraction", Pattern Recognition
* [7] Z.Zivkovic, F. van der Heijden, "Efficient Adaptive Density Estimation
* per Image Pixel for the Task of Background Subtraction", Pattern Recognition
* Letters, vol. 27, no. 7, pages 773-780, 2006.
*
* <refsect2>
@ -90,8 +90,6 @@
#include <config.h>
#endif
#include <gst/gst.h>
#include "gstsegmentation.h"
#include <opencv2/video/background_segm.hpp>
#include <opencv2/imgproc/imgproc_c.h>
@ -382,12 +380,12 @@ gst_segmentation_transform_ip (GstVideoFilter * btrans, GstVideoFrame * frame)
cvCvtColor (filter->cvRGBA, filter->cvRGB, CV_RGBA2RGB);
cvCvtColor (filter->cvRGB, filter->cvYUV, CV_RGB2YCrCb);
/* Create and update a fg/bg model using a codebook approach following the
/* Create and update a fg/bg model using a codebook approach following the
* opencv O'Reilly book [1] implementation of the algo described in [2].
*
* [1] Learning OpenCV: Computer Vision with the OpenCV Library by Gary
* [1] Learning OpenCV: Computer Vision with the OpenCV Library by Gary
* Bradski and Adrian Kaehler, Published by O'Reilly Media, October 3, 2008
* [2] "Real-time Foreground-Background Segmentation using Codebook Model",
* [2] "Real-time Foreground-Background Segmentation using Codebook Model",
* Real-time Imaging, Volume 11, Issue 3, Pages 167-256, June 2005. */
if (METHOD_BOOK == filter->method) {
unsigned cbBounds[3] = { 10, 5, 5 };
@ -429,27 +427,27 @@ gst_segmentation_transform_ip (GstVideoFilter * btrans, GstVideoFrame * frame)
filter->mem_storage, filter->contours);
}
/* Create the foreground and background masks using BackgroundSubtractorMOG [1],
* Gaussian Mixture-based Background/Foreground segmentation algorithm. OpenCV
/* Create the foreground and background masks using BackgroundSubtractorMOG [1],
* Gaussian Mixture-based Background/Foreground segmentation algorithm. OpenCV
* MOG implements the algorithm described in [2].
*
*
* [1] http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractormog
* [2] P. KadewTraKuPong and R. Bowden, "An improved adaptive background
* mixture model for real-time tracking with shadow detection", Proc. 2nd
* [2] P. KadewTraKuPong and R. Bowden, "An improved adaptive background
* mixture model for real-time tracking with shadow detection", Proc. 2nd
* European Workshop on Advanced Video-Based Surveillance Systems, 2001
*/
else if (METHOD_MOG == filter->method) {
run_mog_iteration (filter);
}
/* Create the foreground and background masks using BackgroundSubtractorMOG2
* [1], Gaussian Mixture-based Background/Foreground segmentation algorithm.
* [1], Gaussian Mixture-based Background/Foreground segmentation algorithm.
* OpenCV MOG2 implements the algorithm described in [2] and [3].
*
*
* [1] http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractormog2
* [2] Z.Zivkovic, "Improved adaptive Gausian mixture model for background
* [2] Z.Zivkovic, "Improved adaptive Gausian mixture model for background
* subtraction", International Conference Pattern Recognition, UK, Aug 2004.
* [3] Z.Zivkovic, F. van der Heijden, "Efficient Adaptive Density Estimation
* per Image Pixel for the Task of Background Subtraction", Pattern
* [3] Z.Zivkovic, F. van der Heijden, "Efficient Adaptive Density Estimation
* per Image Pixel for the Task of Background Subtraction", Pattern
* Recognition Letters, vol. 27, no. 7, pages 773-780, 2006. */
else if (METHOD_MOG2 == filter->method) {
run_mog2_iteration (filter);
@ -487,20 +485,20 @@ gst_segmentation_plugin_init (GstPlugin * plugin)
#ifdef CODE_FROM_OREILLY_BOOK /* See license at the beginning of the page */
/*
int update_codebook(uchar *p, codeBook &c, unsigned cbBounds)
Updates the codebook entry with a new data point
p Pointer to a YUV or HSI pixel
c Codebook for this pixel
cbBounds Learning bounds for codebook (Rule of thumb: 10)
numChannels Number of color channels we¡¯re learning
NOTES:
cvBounds must be of length equal to numChannels
RETURN
codebook index
/*
int update_codebook(uchar *p, codeBook &c, unsigned cbBounds)
Updates the codebook entry with a new data point
p Pointer to a YUV or HSI pixel
c Codebook for this pixel
cbBounds Learning bounds for codebook (Rule of thumb: 10)
numChannels Number of color channels we¡¯re learning
NOTES:
cvBounds must be of length equal to numChannels
RETURN
codebook index
*/
int
update_codebook (unsigned char *p, codeBook * c, unsigned *cbBounds,
@ -589,14 +587,14 @@ update_codebook (unsigned char *p, codeBook * c, unsigned *cbBounds,
/*
int clear_stale_entries(codeBook &c)
During learning, after you've learned for some period of time,
periodically call this to clear out stale codebook entries
c Codebook to clean up
Return
number of entries cleared
int clear_stale_entries(codeBook &c)
During learning, after you've learned for some period of time,
periodically call this to clear out stale codebook entries
c Codebook to clean up
Return
number of entries cleared
*/
int
clear_stale_entries (codeBook * c)
@ -640,27 +638,27 @@ clear_stale_entries (codeBook * c)
/*
uchar background_diff( uchar *p, codeBook &c,
int minMod, int maxMod)
Given a pixel and a codebook, determine if the pixel is
covered by the codebook
p Pixel pointer (YUV interleaved)
c Codebook reference
numChannels Number of channels we are testing
maxMod Add this (possibly negative) number onto
uchar background_diff( uchar *p, codeBook &c,
int minMod, int maxMod)
Given a pixel and a codebook, determine if the pixel is
covered by the codebook
max level when determining if new pixel is foreground
minMod Subract this (possibly negative) number from
min level when determining if new pixel is foreground
NOTES:
minMod and maxMod must have length numChannels,
e.g. 3 channels => minMod[3], maxMod[3]. There is one min and
one max threshold per channel.
Return
0 => background, 255 => foreground
p Pixel pointer (YUV interleaved)
c Codebook reference
numChannels Number of channels we are testing
maxMod Add this (possibly negative) number onto
max level when determining if new pixel is foreground
minMod Subract this (possibly negative) number from
min level when determining if new pixel is foreground
NOTES:
minMod and maxMod must have length numChannels,
e.g. 3 channels => minMod[3], maxMod[3]. There is one min and
one max threshold per channel.
Return
0 => background, 255 => foreground
*/
unsigned char
background_diff (unsigned char *p, codeBook * c, int numChannels,
@ -799,12 +797,12 @@ run_mog_iteration (GstSegmentation * filter)
(uchar *) filter->cvFG->imageData;
/*
BackgroundSubtractorMOG [1], Gaussian Mixture-based Background/Foreground
BackgroundSubtractorMOG [1], Gaussian Mixture-based Background/Foreground
Segmentation Algorithm. OpenCV MOG implements the algorithm described in [2].
[1] http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractormog
[2] P. KadewTraKuPong and R. Bowden, "An improved adaptive background
mixture model for real-time tracking with shadow detection", Proc. 2nd
[2] P. KadewTraKuPong and R. Bowden, "An improved adaptive background
mixture model for real-time tracking with shadow detection", Proc. 2nd
European Workshop on Advanced Video-Based Surveillance Systems, 2001
*/
@ -824,15 +822,15 @@ run_mog2_iteration (GstSegmentation * filter)
(uchar *) filter->cvFG->imageData;
/*
BackgroundSubtractorMOG2 [1], Gaussian Mixture-based Background/Foreground
segmentation algorithm. OpenCV MOG2 implements the algorithm described in
BackgroundSubtractorMOG2 [1], Gaussian Mixture-based Background/Foreground
segmentation algorithm. OpenCV MOG2 implements the algorithm described in
[2] and [3].
[1] http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractormog2
[2] Z.Zivkovic, "Improved adaptive Gausian mixture model for background
[2] Z.Zivkovic, "Improved adaptive Gausian mixture model for background
subtraction", International Conference Pattern Recognition, UK, August, 2004.
[3] Z.Zivkovic, F. van der Heijden, "Efficient Adaptive Density Estimation per
Image Pixel for the Task of Background Subtraction", Pattern Recognition
[3] Z.Zivkovic, F. van der Heijden, "Efficient Adaptive Density Estimation per
Image Pixel for the Task of Background Subtraction", Pattern Recognition
Letters, vol. 27, no. 7, pages 773-780, 2006.
*/

View file

@ -1,7 +1,7 @@
/*
* GStreamer
* Copyright (C) 2013 Miguel Casas-Sanchez <miguelecasassanchez@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -58,9 +58,6 @@
#include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gstskindetect.h"
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/legacy/compat.hpp>
@ -327,7 +324,7 @@ gst_skin_detect_transform (GstOpencvVideoFilter * base, GstBuffer * buf,
cvCvtColor (filter->cvRGB, filter->cvHSV, CV_RGB2HSV);
cvCvtPixToPlane (filter->cvHSV, filter->cvH, filter->cvS, filter->cvV, 0); /* Extract the 3 color components. */
/* Detect which pixels in each of the H, S and V channels are probably skin pixels.
/* Detect which pixels in each of the H, S and V channels are probably skin pixels.
Assume that skin has a Hue between 0 to 18 (out of 180), and Saturation above 50, and Brightness above 80. */
cvThreshold (filter->cvH, filter->cvH2, 10, UCHAR_MAX, CV_THRESH_BINARY); /* (hue > 10) */
cvThreshold (filter->cvH, filter->cvH, 20, UCHAR_MAX, CV_THRESH_BINARY_INV); /* (hue < 20) */
@ -337,7 +334,7 @@ gst_skin_detect_transform (GstOpencvVideoFilter * base, GstBuffer * buf,
/* erode the HUE to get rid of noise. */
cvErode (filter->cvH, filter->cvH, NULL, 1);
/* Combine all 3 thresholded color components, so that an output pixel will only
/* Combine all 3 thresholded color components, so that an output pixel will only
be white (255) if the H, S and V pixels were also white.
imageSkin = (hue > 10) ^ (hue < 20) ^ (sat > 48) ^ (val > 80), where ^ mean pixels-wise AND */
cvAnd (filter->cvH, filter->cvS, filter->cvSkinPixels1, NULL);
@ -375,7 +372,7 @@ gst_skin_detect_transform (GstOpencvVideoFilter * base, GstBuffer * buf,
cvCvtColor (filter->cvdraft, filter->cvRGB, CV_GRAY2RGB);
}
/* After this we have a RGB Black and white image with the skin, in
/* After this we have a RGB Black and white image with the skin, in
filter->cvRGB. We can postprocess by applying 1 erode-dilate and 1
dilate-erode, or alternatively 1 opening-closing all together, with
the goal of removing small (spurious) skin spots and creating large

View file

@ -3,7 +3,7 @@
* Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -46,8 +46,6 @@
#ifndef __GST_SKIN_DETECT_H__
#define __GST_SKIN_DETECT_H__
#include <gst/gst.h>
#include <gstopencvvideofilter.h>
G_BEGIN_DECLS

View file

@ -61,10 +61,7 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "../../gst-libs/gst/gst-i18n-plugin.h"
#include "gstopencvutils.h"
#include "gsttemplatematch.h"
#include <opencv2/imgproc/imgproc_c.h>

View file

@ -3,7 +3,7 @@
* Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -47,6 +47,7 @@
#define __GST_TEMPLATE_MATCH_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#ifdef HAVE_HIGHGUI_H
#include <highgui.h> // includes highGUI definitions

View file

@ -60,9 +60,6 @@
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstopencvutils.h"
#include "gsttextoverlay.h"
GST_DEBUG_CATEGORY_STATIC (gst_opencv_text_overlay_debug);

View file

@ -3,7 +3,7 @@
* Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2010 Sreerenj Balachandran <bsreerenj@gmail.com>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@ -47,7 +47,7 @@
#define __GST_OPENCV_TEXT_OVERLAY_H__
#include <gst/gst.h>
#include "gstopencvutils.h"
#include <gst/video/video.h>
#include <opencv2/core/core_c.h>
G_BEGIN_DECLS
@ -73,7 +73,7 @@ struct _GstOpencvTextOverlay
GstPad *sinkpad, *srcpad;
IplImage *cvImage;
CvFont font;
CvFont font;
gint xpos;
gint ypos;
@ -85,7 +85,7 @@ struct _GstOpencvTextOverlay
};
struct _GstOpencvTextOverlayClass
struct _GstOpencvTextOverlayClass
{
GstElementClass parent_class;
};