GNOME Bugzilla – Bug 753994
opencv/faceblur: does not work with OpenCV newer than 2.4.10
Last modified: 2015-10-02 16:44:16 UTC
$ gst-launch-1.0 autovideosrc ! videoconvert ! faceblur ! videoconvert ! autovideosink When I run this, the face blurred is not detected in the camera. It is due to the new structure of the classifier "CascadeClassifier" that opencv used in versions newer than 2.4.10. "gstfaceblur.c" should be transform C ++ language and to use the "load" method to load the old and new structure of the classifier. Previously the classifier was: <haarcascade_frontalface_default type_id="opencv-haar-classifier"> Now it is: <cascade type_id="opencv-cascade-classifier"><stageType>BOOST</stageType>
Created attachment 310011 [details] [review] Change gstfaceblur to C++ Change the gstfaceblur.c file to cpp and add it into Makefile. It is necessary to migrate the faceblur plugin to C++, in order to load new and old classifiers, to make faceblur work with newer versions of Opencv. https://bugzilla.gnome.org/show_bug.cgi?id=753994 Ready for review.
Created attachment 310012 [details] [review] Code refactoring of gst_face_blur_load_profile Changes inside the gst_face_blur_load_profile function, the number of input parameters and in lines where it is used due to it cannot be used generically. https://bugzilla.gnome.org/show_bug.cgi?id=753994 Ready for review.
Created attachment 310018 [details] [review] Check CvHaarClassifierCascade is release before being modified. For PROP_PROFILE case that exist inside gst_face_blur_set_property function loads the new XML file in the CvHaarClassifierCascade property without first checking that it is released because maybe there is an XML file previously loaded. https://bugzilla.gnome.org/show_bug.cgi?id=753994
Ready for review the last patch too.
Will review in a few hours.
Review of attachment 310011 [details] [review]: Looks good.
Review of attachment 310012 [details] [review]: Looks good as well.
Review of attachment 310018 [details] [review]: Looks good. Now the missing part is switching to use the new CascadeClassifier () API for this element to work.
Created attachment 310043 [details] [review] Need to migrate to C++ The cascade classifier changes its structure on new version of OpenCV 2.4.11. It is need to migrate to C++ to utilize the new load method of OpenCV which allows to load the old and new classifiers. https://bugzilla.gnome.org/show_bug.cgi?id=753994 Ready for review.
Created attachment 310044 [details] Test Image of faceblur
Review of attachment 310043 [details] [review]: Commit subject should be: faceblur: need to migrate to new version of OpenCV 2.4.11 Besides that... It works well. Great job! :)
Created attachment 310045 [details] [review] Need to migrate to new version of OpenCV The cascade classifier changes its structure on new version of OpenCV 2.4.11. It is need to migrate to C++ to utilize the new load method of OpenCV which allows to load the old and new classifiers. https://bugzilla.gnome.org/show_bug.cgi?id=753994 I changed the subject of this patch.
Created attachment 310046 [details] [review] Remove unused variable. Memory is reserved for this variable and then released without making any use of it. https://bugzilla.gnome.org/show_bug.cgi?id=753994
Review of attachment 310045 [details] [review]: Thanks
Review of attachment 310046 [details] [review]: Looks good. Will merge after freeze.
Created attachment 310056 [details] [review] textoverlay: remove unused variable Not related to faceblur, but it is related to the last patch in the faceblur series. It doesn't really deserve it's own bug and I just wanted to save it here until the freeze.
Review of attachment 310056 [details] [review]: Wait till after freeze.
Review of attachment 310056 [details] [review]: Merged.
Review of attachment 310011 [details] [review]: commit 6193f52f2d88d0fd8ec286d9446c3ad21345a89d Author: Vanessa Chipirrás Navalón <vchipirras6@gmail.com> Date: Wed Aug 26 11:57:24 2015 +0200 faceblur: Change gstfaceblur to C++. Change the gstfaceblur.c file to cpp and add it into Makefile. It is necessary to migrate the faceblur plugin to C++, in order to load new and old classifiers, to make faceblur work with newer versions of Opencv. https://bugzilla.gnome.org/show_bug.cgi?id=753994
Review of attachment 310012 [details] [review]: commit bbd16144ca4c572485a4b74f0cf10f701d867e9b Author: Vanessa Chipirrás Navalón <vchipirras6@gmail.com> Date: Wed Aug 26 12:27:15 2015 +0200 faceblur: Code refactoring of gst_face_blur_load_profile. Changes inside the gst_face_blur_load_profile function, the number of input parameters and in lines where it is used due to it cannot be used generically. https://bugzilla.gnome.org/show_bug.cgi?id=753994
Review of attachment 310018 [details] [review]: commit acdcfedde27fc33dfc13a091228405c5526706f3 Author: Vanessa Chipirrás Navalón <vchipirras6@gmail.com> Date: Wed Aug 26 12:47:58 2015 +0200 faceblur: Check CvHaarClassifierCascade is release before being modified. For PROP_PROFILE case that exist inside gst_face_blur_set_property function loads the new XML file in the CvHaarClassifierCascade property without first checking that it is released because maybe there is an XML file previously loaded. https://bugzilla.gnome.org/show_bug.cgi?id=753994
Review of attachment 310046 [details] [review]: commit 02d8a4f4e8b86c4b27a3e687beec1504aea066b6 Author: Vanessa Chipirrás Navalón <vchipirras6@gmail.com> Date: Wed Aug 26 17:56:50 2015 +0200 faceblur: need to migrate to C++. The cascade classifier changes its structure on new version of OpenCV 2.4.11. It is need to migrate to C++ to utilize the new load method of OpenCV which allows to load the old and new classifiers. https://bugzilla.gnome.org/show_bug.cgi?id=753994
Review of attachment 310045 [details] [review]: commit 02d8a4f4e8b86c4b27a3e687beec1504aea066b6 Author: Vanessa Chipirrás Navalón <vchipirras6@gmail.com> Date: Wed Aug 26 17:56:50 2015 +0200 faceblur: need to migrate to C++. The cascade classifier changes its structure on new version of OpenCV 2.4.11. It is need to migrate to C++ to utilize the new load method of OpenCV which allows to load the old and new classifiers. https://bugzilla.gnome.org/show_bug.cgi?id=753994