Some distributions store OpenCV files in /usr/share/opencv and some others
(and default when building from source) install them in
/usr/share/OpenCV. Support both to find cascade files.
https://bugzilla.gnome.org/show_bug.cgi?id=753651
Checking the vector is not empty and checking the vector size is greater
than zero are the same thing, this is a redundancy in the code. Only
checking the vector is not empty is sufficient, therefore removing the
other check.
Since the profile gchar depends on DEFAULT_FACE_PROFILE, it should never be
NULL. Furthermore CascadeClassifier accepts any input, even
an empty one, but if the profile fails to load it returns an empty cascade.
Check for this instead, and inform the user if there was an Error.
Check if profile is NULL before dereferencing it with new. Also, new will
never return NULL; if allocation fails, a std::bad_alloc exception will be
thrown instead. Remove check for a NULL return.
CID #1315258
With the switch of gstopencv.c to C++, all OpenCV elements are built with
g++. The template variable clashes with C++'s feature of the same name.
Rename template to templ to avoid any clash.
The cascade classifier changes its structure on new version of OpenCV.
The need to migrate to C++ to utilize the new load method of OpenCV which
allows to load the new classifiers.
https://bugzilla.gnome.org/show_bug.cgi?id=748377
The property level has a minimum value of 0. But when we set the level as 0,
it gets an assertion error. The function icvPyrSegmentation8uC3R returns false
if level is set as 0, since the minimum level cant be 0 and thus results in error.
Hence changing the minimum value to 1.
https://bugzilla.gnome.org/show_bug.cgi?id=749525
Variable hands is already checked to contain a value previously at the beginning
of the current block. There is no need to check again. This is logically dead code.
CID 1197693
If old opencv1-style legacy include directory is available,
this change becomes purely cosmetic (maybe will compile a bit faster).
It becomes an FTBFS fix when opencv1-style include directory is missing
(possibly because opencv package maintainer decided not to pack it).
https://bugzilla.gnome.org/show_bug.cgi?id=747705
If searchIdx() doesn't find the id it returns -1, which breaks
motioncelssvector.at (idx). Check for it and return if not found.
Changing a few other lines for style consistency.
Some variables are not initialized in the constructor. It is highly unlikely
they are used before being set, but it is safer to initialize them.
CID #1197704
Variable hands is already checked to contain a value previously at the beginning
of the current block (in line 504). There is no need to check again. This is
logically dead code.
CID 1197693
face detection will be performed only if image standard deviation is
greater that min-stddev. Default min-stddev is 0 for backward
compatibility. This property will avoid to perform face detection on
images with little changes improving cpu usage and reducing false
positives
https://bugzilla.gnome.org/show_bug.cgi?id=730510
templatematch operates on BGR data. In fact, OpenCV's IplImage always
stores color image data in BGR order -- this isn't documented at all in
the OpenCV source code, but there are hints around the web (see for
example
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html#SECTION00041000000000000000
and http://www.comp.leeds.ac.uk/vision/opencv/iplimage.html ).
gst_templatematch_load_template loads the template (the image to find)
from disk using OpenCV's cvLoadImage, so it is stored in an IplImage in
BGR order. But in gst_templatematch_chain, no OpenCV conversion
functions are used: the imageData pointer of the IplImage for the video
frame (the image to search in) is just set to point to the raw buffer
data. Without this fix, that raw data is in RGB order, so the call to
cvMatchTemplate ends up comparing the template's Blue channel against
the frame's Red channel, producing very poor results.
Previously changing the template property resulted in an exception
thrown from cvMatchTemplate, because "dist_image" (the intermediate
match-certainty-distribution) was the wrong size (because the
template image size had changed).
Locking has also been added to allow changing the properties (e.g. the
pattern to match) while the pipeline is playing.
* gst_element_post_message is moved outside of the lock, because it will
call into arbitrary user code (otherwise, if that user code calls into
gst_templatematch_set_property on this same thread it would deadlock).
* gst_template_match_load_template: If we fail to load the new template
we still unload the previous template, so this element becomes a no-op
in the pipeline. The alternative would be to keep the previous template;
I believe unloading the previous template is a better choice, because it
is consistent with the state this element would be in if it fails to
load the very first template at start-up.
Thanks to Will Manley for the bulk of this work; any errors are probably
mine.
The early return was bypassing the call to gst_pad_push. With no
filter->template (and thus no filter->cvTemplateImage) the rest of this
function is essentially a no-op (except for the call to gst_pad_push).
This (plus the previous commit) allows templatematch to be
enabled/disabled without removing it entirely from the pipeline, by
setting/unsetting the template property.
First this is handle by base transform, hence this is a no-op, and if it wasn't it
would lead to a buffer copy being leaked, and then an unreffed buffer being
pushed downstream.
https://bugzilla.gnome.org/show_bug.cgi?id=732756
Previously faces would only be detected if they were at least 30x30 pixels
large and at most 32x32 pixels. We keep the minimum setting (maybe needs
a property as in facedetect) but disable the maximum feature size.
See https://bugzilla.gnome.org/show_bug.cgi?id=722158
This disables the "max feature size" feature. The current configuration
is totally busted: The max feature size is hard-coded to 2 pixels more
than the user-supplied min feature size which pretty much means you need
to guess the size of the person's face to within a few pixels to get the
code to find it.
https://bugzilla.gnome.org/show_bug.cgi?id=722158
Fixes:
In file included from gstsegmentation.h:51:0,
from gstopencv.c:42:
/usr/include/opencv2/video/background_segm.hpp:47:16: fatal error: list:
No such file or directory
#include <list>
^
compilation terminated.
https://bugzilla.gnome.org/show_bug.cgi?id=702297
Add colour image enhancement element based on Retinex algorithm. Two types
exist, namely basic and multiscale; both are described in this article:
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
Visually speaking the result looks a bit funny, but is pretty invariable to
lightning changes, which is good for some applications, like image
segmentation.
https://bugzilla.gnome.org/show_bug.cgi?id=700977
gstpyramidsegment.c: In function 'gst_pyramid_segment_chain':
gstpyramidsegment.c:307:3: error: implicit declaration of function
'cvPyrSegmentation' [-Werror=implicit-function-declaration]
gstpyramidsegment.c:307:3: error: nested extern declaration of
'cvPyrSegmentation' [-Werror=nested-externs]
https://bugzilla.gnome.org/show_bug.cgi?id=687237
AC_CHECK_HEADERS() calls action-if-not-found also if just one of
the headers checked for is missing, which is not what we wanted.
Also, check for highgui_c.h instead of highgui.hpp.
https://bugzilla.gnome.org/show_bug.cgi?id=672226
Where highgui.h doesn't exist any more, but only opencv2/highgui/highgui.hpp.
Also, not quite sure why we're checking for cvaux.h, it's not used anywhere.
Some elements had vague caps, such as "video/x-raw-rgb", which caused problems
at least with textwrite. For other elements, the underlying OpenCV functions
support more than just one image type, so I increased the number of supported
caps.
I created a utility function "gst_opencv_caps_from_cv_image_type", so each
element creates caps directly from OpenCV image types, such as CV_8UC1 for
8-bit grayscale. This function uses gstvideo to create uniform caps.
https://bugzilla.gnome.org/show_bug.cgi?id=635304
Compile with -DCV_NO_BACKWARD_COMPATIBILITY for now, so that the compat header
doesn't get included, which causes compiler warnings that (it seems) can't be
switched off easily. As a result, we also specify a max. version in configure,
so the build doesn't break if our code doesn't compile against newer opencv
versions any more with that flag.
Override CV_INLINE to avoid 'unused' gcc warnings. GLib will take care of defining
'inline' sufficiently and OpenCV's define isn't good enough to avoid 'unused'
compiler warnings (at least in version 2.1.0).
Add a message to be post when faces are found on a frame that
contains all faces on a single message and also has
timestamp/running/segment times for that buffer so it
can be identified.
This message is called 'facedetect' and has a 'faces' list
of structures with all faces.
The old 'face' message is still posted for each face found, but
it is not really useful as it doesn't have any reference to the
buffer that generated it.
Adds new cvlaplace element.
Also adds a new opencvbasetransform function to be overriden
by children classes: the cv_set_caps, it allows children classes
to know what are they going to handle and prepare properly.
Deactivate blur-no-scale because basetransform doesn't provide a way
to override getcaps for pads, always using templatecaps independent
of properties.
Allocate a new output buffer instead of using the input buffer
pointing to the internal cvCEdge opencv's IplImage data, which
might change, consequently changing the buffer.
* Implement pyramid segmentation element
* Make masking optional on edgedetect
* Clean up edgedetect, add element details
* Implemented edge detect element