Bug 358910 - OpenCV 3.1 support for libkface
Summary: OpenCV 3.1 support for libkface
Status: RESOLVED FIXED
Alias: None
Product: libkface
Classification: Frameworks and Libraries
Component: General (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: imaging-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-02 11:30 UTC by Weng Xuetian
Modified: 2017-03-09 14:49 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Weng Xuetian 2016-02-02 11:30:25 UTC
libkface doesn't compile with opencv 3.1, because of upstream change of opencv-face interface.

I made a patch for it at:
https://git.reviewboard.kde.org/r/126833/


Reproducible: Always
Comment 1 Willy Sudiarto Raharjo 2016-02-22 15:48:26 UTC
Hi

i tested this patch against libkface 15.08.3 and it still have one error left

/tmp/SBo/libkface-15.08.3/libkface/recognition-opencv-lbph/facerec_borrowed.cpp:516:115:
error: invalid new-expression of abstract class type
‘KFaceIface::LBPHFaceRecognizer’
     LBPHFaceRecognizer* const fr = new LBPHFaceRecognizer(radius,
neighbors, grid_x, grid_y, threshold, statistics);

                                            ^
In file included from
/tmp/SBo/libkface-15.08.3/libkface/recognition-opencv-lbph/facerec_borrowed.cpp:39:0:
Comment 2 Taurnil 2016-05-24 17:20:32 UTC
Also ran into this problem using libkface-16.04.1. After realizing I needed opencv_contrib-3.1.0 because I have libkface use -DENABLE_OPENCV3=1 I needed to recompile opencv-3.1.0 with those contribs.  Here is the compile output without the patch mentioned above;

Building libkface version 16.04.1
+ running "default_pre_build"
+ validating "/usr/src/libkface-16.04.1"
+ creating building dir "/usr/src/libkface-16.04.1"
+ Removing old source directory first!
+ Unpacking "/var/spool/lunar/libkface-16.04.1.tar.xz" in "/usr/src"
+ building "libkface" version "16.04.1" in /usr/src/libkface-16.04.1
+ CC_EXT="ccache "
+ CXX_EXT="ccache "
+ CC="gcc"
+ CXX="g++"
+ CPP="cpp"
+ CFLAGS=" -O2 -march=native -pipe"
+ CXXFLAGS=" -O2 -march=native -pipe"
+ CPPFLAGS=" -D_FORTIFY_SOURCE=2"
+ LDFLAGS=" -s"
+ Enabled wrapper script usage
+ running "default_cmake_build"
+ running "default_cmake_config"
+ MODULE_PREFIX="/usr"
+ running "Out of source build is required; configuring"
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: /var/lib/lunar/compilers/gcc
-- Check for working C compiler: /var/lib/lunar/compilers/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /var/lib/lunar/compilers/g++
-- Check for working CXX compiler: /var/lib/lunar/compilers/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ----------------------------------------------------------------------------------
-- Starting CMake configuration for: libkface
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- First try at finding OpenCV...
-- Great, found OpenCV on the first try.
-- OpenCV Root directory is: /usr/share/OpenCV
-- OpenCV: Found version 3.1.0 (required: 3.0.0)
-- OpenCV headers: /usr/include/opencv;/usr/include
-- OpenCV libs   : opencv_core;opencv_face;opencv_highgui;opencv_objdetect;opencv_imgproc
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success

-- 
-- The following REQUIRED packages have been found:

 * ECM (required version >= 1.1.0)
 * Qt5Core
 * Qt5Widgets
 * Qt5Sql
 * Qt5Xml
 * Qt5Gui
 * Qt5 (required version >= 5.2.0)
 * OpenCV

-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/libkface-16.04.1/libkface-oosb
+ running "default_make"
Scanning dependencies of target extract_funnel_data
[  4%] Generating face-funnel.data
[  4%] Built target extract_funnel_data
Scanning dependencies of target KF5KFace_automoc
[  8%] Automatic moc for target KF5KFace
Generating moc_databasecorebackend.cpp
[  8%] Built target KF5KFace_automoc
Scanning dependencies of target KF5KFace
[ 12%] Building CXX object src/CMakeFiles/KF5KFace.dir/detection/opencvfacedetector.cpp.o
[ 16%] Building CXX object src/CMakeFiles/KF5KFace.dir/recognition-opencv-lbph/lbphfacemodel.cpp.o
In file included from /usr/src/libkface-16.04.1/libkface-oosb/src/libopencv.h:59:0,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/lbphfacemodel.h:35,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/lbphfacemodel.cpp:30:
/usr/include/opencv2/face.hpp:308:18: warning: 'virtual void cv::face::FaceRecognizer::predict(cv::InputArray, cv::Ptr<cv::face::PredictCollector>, int) const' was hidden [-Woverloaded-virtual]
     CV_WRAP virtual void predict(InputArray src, Ptr<PredictCollector> collector, const int state = 0) const = 0;
                  ^
In file included from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/lbphfacemodel.h:44:0,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/lbphfacemodel.cpp:30:
/usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.h:136:10: warning:   by 'KFaceIface::LBPHFaceRecognizer::predict' [-Woverloaded-virtual]
     void predict(cv::InputArray _src, int &label, double &dist) const;
          ^
[ 20%] Building CXX object src/CMakeFiles/KF5KFace.dir/recognition-opencv-lbph/opencvlbphfacerecognizer.cpp.o
In file included from /usr/src/libkface-16.04.1/libkface-oosb/src/libopencv.h:59:0,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/opencvlbphfacerecognizer.h:35,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/opencvlbphfacerecognizer.cpp:30:
/usr/include/opencv2/face.hpp:308:18: warning: 'virtual void cv::face::FaceRecognizer::predict(cv::InputArray, cv::Ptr<cv::face::PredictCollector>, int) const' was hidden [-Woverloaded-virtual]
     CV_WRAP virtual void predict(InputArray src, Ptr<PredictCollector> collector, const int state = 0) const = 0;
                  ^
In file included from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/lbphfacemodel.h:44:0,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/opencvlbphfacerecognizer.cpp:37:
/usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.h:136:10: warning:   by 'KFaceIface::LBPHFaceRecognizer::predict' [-Woverloaded-virtual]
     void predict(cv::InputArray _src, int &label, double &dist) const;
          ^
[ 25%] Building CXX object src/CMakeFiles/KF5KFace.dir/recognition-opencv-lbph/facerec_borrowed.cpp.o
In file included from /usr/src/libkface-16.04.1/libkface-oosb/src/libopencv.h:59:0,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.h:39,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.cpp:39:
/usr/include/opencv2/face.hpp:308:18: warning: 'virtual void cv::face::FaceRecognizer::predict(cv::InputArray, cv::Ptr<cv::face::PredictCollector>, int) const' was hidden [-Woverloaded-virtual]
     CV_WRAP virtual void predict(InputArray src, Ptr<PredictCollector> collector, const int state = 0) const = 0;
                  ^
In file included from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.cpp:39:0:
/usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.h:136:10: warning:   by 'KFaceIface::LBPHFaceRecognizer::predict' [-Woverloaded-virtual]
     void predict(cv::InputArray _src, int &label, double &dist) const;
          ^
/usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.cpp: In static member function 'static cv::Ptr<KFaceIface::LBPHFaceRecognizer> KFaceIface::LBPHFaceRecognizer::create(int, int, int, int, double, KFaceIface::LBPHFaceRecognizer::PredictionStatistics)':
/usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.cpp:516:115: error: invalid new-expression of abstract class type 'KFaceIface::LBPHFaceRecognizer'
     LBPHFaceRecognizer* const fr = new LBPHFaceRecognizer(radius, neighbors, grid_x, grid_y, threshold, statistics);
                                                                                                                   ^
In file included from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.cpp:39:0:
/usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.h:51:7: note:   because the following virtual functions are pure within 'KFaceIface::LBPHFaceRecognizer':
 class LBPHFaceRecognizer : public cv::face::FaceRecognizer
       ^
In file included from /usr/src/libkface-16.04.1/libkface-oosb/src/libopencv.h:59:0,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.h:39,
                 from /usr/src/libkface-16.04.1/src/recognition-opencv-lbph/facerec_borrowed.cpp:39:
/usr/include/opencv2/face.hpp:308:18: note:     virtual void cv::face::FaceRecognizer::predict(cv::InputArray, cv::Ptr<cv::face::PredictCollector>, int) const
     CV_WRAP virtual void predict(InputArray src, Ptr<PredictCollector> collector, const int state = 0) const = 0;
                  ^
src/CMakeFiles/KF5KFace.dir/build.make:134: recipe for target 'src/CMakeFiles/KF5KFace.dir/recognition-opencv-lbph/facerec_borrowed.cpp.o' failed
make[2]: *** [src/CMakeFiles/KF5KFace.dir/recognition-opencv-lbph/facerec_borrowed.cpp.o] Error 1
CMakeFiles/Makefile2:173: recipe for target 'src/CMakeFiles/KF5KFace.dir/all' failed
make[1]: *** [src/CMakeFiles/KF5KFace.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Comment 3 Rex Dieter 2017-03-09 14:49:42 UTC
I can confirm libkface-16.12 works with opencv 3.1 since the referenced reviewboard was committed

Submitted with commit ec6e82328cac37c9d59b49245b18c3f0abee4d8f by Andreas Sturmlechner on behalf of Xuetian Weng to branch master.



(same cannot be said of opencv 3.2, but I'll file a separate bug tracking that