summaryrefslogtreecommitdiff
path: root/graphics/libkface
diff options
context:
space:
mode:
authormarkd <markd>2015-11-03 20:28:57 +0000
committermarkd <markd>2015-11-03 20:28:57 +0000
commitb7a0791e5a30b4fa66550792b75f5e33bdbcdc39 (patch)
tree419f267d8e687be2404fef6a5edf689fdd9cfb53 /graphics/libkface
parent74bd28b00759cc4a26d0d17d3cae74036b2e1eff (diff)
downloadpkgsrc-b7a0791e5a30b4fa66550792b75f5e33bdbcdc39.tar.gz
Update to 4.13.0 (part of digikam 4.13.0)
Apply upstream patches for opencv3.
Diffstat (limited to 'graphics/libkface')
-rw-r--r--graphics/libkface/Makefile9
-rw-r--r--graphics/libkface/PLIST11
-rw-r--r--graphics/libkface/distinfo17
-rw-r--r--graphics/libkface/patches/patch-CMakeLists.txt29
-rw-r--r--graphics/libkface/patches/patch-README18
-rw-r--r--graphics/libkface/patches/patch-libkface_CMakeLists.txt22
-rw-r--r--graphics/libkface/patches/patch-libkface_detection_opencvfacedetector.cpp31
-rw-r--r--graphics/libkface/patches/patch-libkface_libopencv.h.cmake.in76
-rw-r--r--graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.cpp32
-rw-r--r--graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.h76
-rw-r--r--graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_lbphfacemodel.cpp155
11 files changed, 464 insertions, 12 deletions
diff --git a/graphics/libkface/Makefile b/graphics/libkface/Makefile
index b13c18707d7..3cd14c1e93f 100644
--- a/graphics/libkface/Makefile
+++ b/graphics/libkface/Makefile
@@ -1,9 +1,8 @@
-# $NetBSD: Makefile,v 1.27 2015/04/25 14:23:16 tnn Exp $
+# $NetBSD: Makefile,v 1.28 2015/11/03 20:28:57 markd Exp $
#
-PKGNAME= libkface-4.4.0
-PKGREVISION= 2
-DISTNAME= digikam-4.4.0
+PKGNAME= libkface-4.13.0
+DISTNAME= digikam-4.13.0
CATEGORIES= graphics
MASTER_SITES= ${MASTER_SITE_KDE:=digikam/}
EXTRACT_SUFX= .tar.bz2
@@ -17,6 +16,7 @@ BUILD_DEPENDS+= automoc4>=0.9.83:../../devel/automoc4
USE_LANGUAGES= c c++
USE_TOOLS+= pkg-config
+CMAKE_ARGS+= -DENABLE_OPENCV3:BOOL=ON
PKGCONFIG_OVERRIDE+= libkface.pc.cmake
@@ -24,5 +24,6 @@ WRKSRC= ${WRKDIR}/${DISTNAME}/extra/libkface
.include "../../meta-pkgs/kde4/kde4.mk"
.include "../../graphics/opencv/buildlink3.mk"
+.include "../../graphics/opencv-contrib-face/buildlink3.mk"
.include "../../x11/kdelibs4/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/graphics/libkface/PLIST b/graphics/libkface/PLIST
index 8e22b40c00d..ed1dff6a68c 100644
--- a/graphics/libkface/PLIST
+++ b/graphics/libkface/PLIST
@@ -1,15 +1,18 @@
-@comment $NetBSD: PLIST,v 1.2 2013/11/10 03:19:27 markd Exp $
+@comment $NetBSD: PLIST,v 1.3 2015/11/03 20:28:57 markd Exp $
include/libkface/dataproviders.h
include/libkface/facedetector.h
include/libkface/identity.h
include/libkface/libkface_export.h
include/libkface/recognitiondatabase.h
include/libkface/version.h
+lib/cmake/Kface-3.5.0/Kface-export-relwithdebinfo.cmake
+lib/cmake/Kface-3.5.0/Kface-export.cmake
+lib/cmake/Kface-3.5.0/kface-config-version.cmake
+lib/cmake/Kface-3.5.0/kface-config.cmake
lib/libkface.so
-lib/libkface.so.2
-lib/libkface.so.2.0.0
+lib/libkface.so.3
+lib/libkface.so.3.0.0
lib/pkgconfig/libkface.pc
-share/kde/apps/cmake/modules/FindKface.cmake
share/kde/apps/libkface/alignment-congealing/face-funnel.data
share/kde/apps/libkface/database/dbconfig.xml
share/kde/apps/libkface/haarcascades/haarcascade_frontalface_alt.xml
diff --git a/graphics/libkface/distinfo b/graphics/libkface/distinfo
index f505422dd21..f355ede6752 100644
--- a/graphics/libkface/distinfo
+++ b/graphics/libkface/distinfo
@@ -1,5 +1,14 @@
-$NetBSD: distinfo,v 1.5 2014/11/15 20:58:04 markd Exp $
+$NetBSD: distinfo,v 1.6 2015/11/03 20:28:57 markd Exp $
-SHA1 (digikam-4.4.0.tar.bz2) = 1feb43120addda314e09761440ec2058e430171c
-RMD160 (digikam-4.4.0.tar.bz2) = 540f243361aba3c95b675c05f84d8d60efab1948
-Size (digikam-4.4.0.tar.bz2) = 68871203 bytes
+SHA1 (digikam-4.13.0.tar.bz2) = d696ac88dcb3bcbd3a5da83b0fbe5e7315a43f92
+RMD160 (digikam-4.13.0.tar.bz2) = 11d6aa15a94cd38acca79f2a31f65393a01a2b0b
+SHA512 (digikam-4.13.0.tar.bz2) = 0cadb55f568a34d07f008791ca351428f4cd9e7060ba79aa8acc25e5e38f0bbcd586df764dacbcb9d1dadb56d2fb9160760cc89aeab4d7cef9bdbd26f691752b
+Size (digikam-4.13.0.tar.bz2) = 69554099 bytes
+SHA1 (patch-CMakeLists.txt) = a5c798fc35127996d38ce1103c7b321108f56eaa
+SHA1 (patch-README) = 520dd6ee6562b708fb96adf6bf209056adb5d159
+SHA1 (patch-libkface_CMakeLists.txt) = d183bcfa09244984350fa0ae2957d877618b2d0d
+SHA1 (patch-libkface_detection_opencvfacedetector.cpp) = e8a31a469df3f0bc4d3f3bb2c3864a0913985fab
+SHA1 (patch-libkface_libopencv.h.cmake.in) = 354103b0be8e202630059dc438af9d03837bed72
+SHA1 (patch-libkface_recognition-opencv-lbph_facerec_borrowed.cpp) = d66bbb999105426df7b1281f0e5082f755864c73
+SHA1 (patch-libkface_recognition-opencv-lbph_facerec_borrowed.h) = a69318610fd96dd13e177c7bb93cf22bf9c4768d
+SHA1 (patch-libkface_recognition-opencv-lbph_lbphfacemodel.cpp) = c181d1b94948f7988081b09e3c2bf3190eaf046e
diff --git a/graphics/libkface/patches/patch-CMakeLists.txt b/graphics/libkface/patches/patch-CMakeLists.txt
new file mode 100644
index 00000000000..9f88606edb6
--- /dev/null
+++ b/graphics/libkface/patches/patch-CMakeLists.txt
@@ -0,0 +1,29 @@
+$NetBSD: patch-CMakeLists.txt,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- CMakeLists.txt.orig 2015-09-03 21:22:44.000000000 +0000
++++ CMakeLists.txt
+@@ -10,6 +10,8 @@ project(libkface)
+ message(STATUS "----------------------------------------------------------------------------------")
+ message(STATUS "Starting CMake configuration for: libkface")
+
++option(ENABLE_OPENCV3 "Build libkface with OpenCV3 instead OpenCV2 (default=OFF)" OFF)
++
+ find_package(Qt4 4.6.0 REQUIRED)
+ find_package(KDE4 REQUIRED)
+
+@@ -30,7 +32,12 @@ add_definitions(-DKDE_DEFAULT_DEBUG_AREA
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+
+ include(MacroOpenCV)
+-DETECT_OPENCV(2.4.9 core highgui objdetect contrib legacy imgproc)
++
++if (ENABLE_OPENCV3)
++ DETECT_OPENCV(3.0.0 core face highgui objdetect imgproc)
++else()
++ DETECT_OPENCV(2.4.9 core highgui objdetect contrib legacy imgproc)
++endif()
+
+ include_directories(${OpenCV_INCLUDE_DIRS})
+
diff --git a/graphics/libkface/patches/patch-README b/graphics/libkface/patches/patch-README
new file mode 100644
index 00000000000..6f6e110d058
--- /dev/null
+++ b/graphics/libkface/patches/patch-README
@@ -0,0 +1,18 @@
+$NetBSD: patch-README,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- README.orig 2015-09-03 21:22:44.000000000 +0000
++++ README
+@@ -21,6 +21,11 @@ libqt >= 4.6.x h
+ libkde >= 4.4.x http://www.kde.org
+ libopencv >= 2.4.9 http://opencv.willowgarage.com/wiki (with opencv 'haarcascades' data files)
+
++CMake compilation options to custom libkface:
++
++Use CMake "-DENABLE_OPENCV3=on" flag to compile libkface source code using OpenCV3 instead OpenCV2 (disabled by default).
++ OpenCV3 support needs extra contrib modules package, especially 'face' ands 'legacy' components.
++
+ -- INSTALL ------------------------------------------------------------
+
+ In order to compile, especially when QT3/Qt4 are installed at the same time,
diff --git a/graphics/libkface/patches/patch-libkface_CMakeLists.txt b/graphics/libkface/patches/patch-libkface_CMakeLists.txt
new file mode 100644
index 00000000000..da74d0f480c
--- /dev/null
+++ b/graphics/libkface/patches/patch-libkface_CMakeLists.txt
@@ -0,0 +1,22 @@
+$NetBSD: patch-libkface_CMakeLists.txt,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- libkface/CMakeLists.txt.orig 2015-09-03 21:22:44.000000000 +0000
++++ libkface/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 2010-2014, Gilles Caulier, <caulier dot gilles at gmail dot com>
++# Copyright (c) 2010-2015, Gilles Caulier, <caulier dot gilles at gmail dot com>
+ #
+ # Redistribution and use is allowed according to the terms of the BSD license.
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+@@ -52,7 +52,7 @@ target_link_libraries(kface ${KDE4_KDECO
+ ${QT_QTXML_LIBRARY}
+ ${QT_QTSQL_LIBRARY}
+
+- ${OpenCV_LIBRARIES}
++ ${OpenCV_LIBRARIES} -lopencv_face
+ )
+
+ set_target_properties(kface PROPERTIES VERSION ${KFACE_LIB_SO_VERSION_STRING}
diff --git a/graphics/libkface/patches/patch-libkface_detection_opencvfacedetector.cpp b/graphics/libkface/patches/patch-libkface_detection_opencvfacedetector.cpp
new file mode 100644
index 00000000000..59511920b0d
--- /dev/null
+++ b/graphics/libkface/patches/patch-libkface_detection_opencvfacedetector.cpp
@@ -0,0 +1,31 @@
+$NetBSD: patch-libkface_detection_opencvfacedetector.cpp,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- libkface/detection/opencvfacedetector.cpp.orig 2015-09-03 21:22:44.000000000 +0000
++++ libkface/detection/opencvfacedetector.cpp
+@@ -18,7 +18,7 @@
+ * <a href="alexjironkin at gmail dot com">alexjironkin at gmail dot com</a>
+ * @author Copyright (C) 2010 by Aditya Bhatt
+ * <a href="adityabhatt at gmail dot com">adityabhatt at gmail dot com</a>
+- * @author Copyright (C) 2010-2014 by Gilles Caulier
++ * @author Copyright (C) 2010-2015 by Gilles Caulier
+ * <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
+ * @author Copyright (C) 2010-2013 by Marcel Wiesweg
+ * <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
+@@ -136,13 +136,14 @@ public:
+
+ cv::Size getOriginalWindowSize() const
+ {
++#if OPENCV_VERSION <= OPENCV_MAKE_VERSION(2,4,11)
+ // This is a HACK which may break any time. Work around the fact that getOriginalWindowSize()
+ // always returns (0,0) and we need these values.
+ if (oldCascade)
+ {
+ return oldCascade->orig_window_size;
+ }
+-
++#endif
+ return cv::Size(0, 0);
+ }
+
diff --git a/graphics/libkface/patches/patch-libkface_libopencv.h.cmake.in b/graphics/libkface/patches/patch-libkface_libopencv.h.cmake.in
new file mode 100644
index 00000000000..5052e2f7749
--- /dev/null
+++ b/graphics/libkface/patches/patch-libkface_libopencv.h.cmake.in
@@ -0,0 +1,76 @@
+$NetBSD: patch-libkface_libopencv.h.cmake.in,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- libkface/libopencv.h.cmake.in.orig 2015-09-03 21:22:44.000000000 +0000
++++ libkface/libopencv.h.cmake.in
+@@ -7,7 +7,7 @@
+ * @date 2010-06-16
+ * @brief Wrapper for OpenCV header files
+ *
+- * @author Copyright (C) 2012-2014 by Gilles Caulier
++ * @author Copyright (C) 2012-2015 by Gilles Caulier
+ * <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
+ *
+ * This program is free software; you can redistribute it
+@@ -31,16 +31,16 @@
+
+ // Pragma directives to reduce warnings from OpenCV header files.
+ #if not defined(__APPLE__) && defined(__GNUC__)
+-#pragma GCC diagnostic push
+-#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
+-#pragma GCC diagnostic ignored "-Woverloaded-virtual"
++# pragma GCC diagnostic push
++# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
++# pragma GCC diagnostic ignored "-Woverloaded-virtual"
+ #endif
+
+ #if defined(__APPLE__) && defined(__clang__)
+-#pragma clang diagnostic push
+-#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+-#pragma clang diagnostic ignored "-Woverloaded-virtual"
+-#pragma clang diagnostic ignored "-Wcast-align"
++# pragma clang diagnostic push
++# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
++# pragma clang diagnostic ignored "-Woverloaded-virtual"
++# pragma clang diagnostic ignored "-Wcast-align"
+ #endif
+
+ // OpenCV includes
+@@ -51,23 +51,30 @@
+ #define OPENCV_VERSION OPENCV_MAKE_VERSION(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION)
+ #define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION >= OPENCV_MAKE_VERSION(major,minor,patch) )
+
+-#include <opencv2/core/core.hpp>
+-#include <opencv2/core/internal.hpp>
+-#include <opencv2/contrib/contrib.hpp>
++#if OPENCV_TEST_VERSION(3,0,0)
++# include <opencv2/face.hpp>
++# include <opencv2/core.hpp>
++#else
++# include <opencv2/core/core.hpp>
++# include <opencv2/core/internal.hpp>
++# include <opencv2/contrib/contrib.hpp>
++#endif
+
+ // for old-style code
++#if OPENCV_VERSION <= OPENCV_MAKE_VERSION(2,4,11)
++# include <opencv2/legacy/compat.hpp>
++#endif
+ #include <opencv2/opencv.hpp>
+-#include <opencv2/legacy/compat.hpp>
+ #include <opencv2/highgui/highgui_c.h>
+ #include <opencv/cvaux.h>
+
+ // Restore warnings
+ #if not defined(__APPLE__) && defined(__GNUC__)
+-#pragma GCC diagnostic pop
++# pragma GCC diagnostic pop
+ #endif
+
+ #if defined(__APPLE__) && defined(__clang__)
+-#pragma clang diagnostic pop
++# pragma clang diagnostic pop
+ #endif
+
+ #endif // LIB_OPEN_CV_H
diff --git a/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.cpp b/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.cpp
new file mode 100644
index 00000000000..d1b81f42ddb
--- /dev/null
+++ b/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.cpp
@@ -0,0 +1,32 @@
+$NetBSD: patch-libkface_recognition-opencv-lbph_facerec_borrowed.cpp,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- libkface/recognition-opencv-lbph/facerec_borrowed.cpp.orig 2015-09-03 21:22:44.000000000 +0000
++++ libkface/recognition-opencv-lbph/facerec_borrowed.cpp
+@@ -531,14 +531,16 @@ Ptr<LBPHFaceRecognizer> LBPHFaceRecogniz
+ return ptr;
+ }
+
+-CV_INIT_ALGORITHM(LBPHFaceRecognizer, "FaceRecognizer.LBPH-KFaceIface",
+- obj.info()->addParam(obj, "radius", obj.m_radius);
+- obj.info()->addParam(obj, "neighbors", obj.m_neighbors);
+- obj.info()->addParam(obj, "grid_x", obj.m_grid_x);
+- obj.info()->addParam(obj, "grid_y", obj.m_grid_y);
+- obj.info()->addParam(obj, "threshold", obj.m_threshold);
+- obj.info()->addParam(obj, "histograms", obj.m_histograms); // modification: Make Read/Write
+- obj.info()->addParam(obj, "labels", obj.m_labels); // modification: Make Read/Write
+- obj.info()->addParam(obj, "statistic", obj.m_statisticsMode)); // modification: Add parameter
++#if OPENCV_VERSION <= OPENCV_MAKE_VERSION(2,4,11)
++ CV_INIT_ALGORITHM(LBPHFaceRecognizer, "FaceRecognizer.LBPH-KFaceIface",
++ obj.info()->addParam(obj, "radius", obj.m_radius);
++ obj.info()->addParam(obj, "neighbors", obj.m_neighbors);
++ obj.info()->addParam(obj, "grid_x", obj.m_grid_x);
++ obj.info()->addParam(obj, "grid_y", obj.m_grid_y);
++ obj.info()->addParam(obj, "threshold", obj.m_threshold);
++ obj.info()->addParam(obj, "histograms", obj.m_histograms); // modification: Make Read/Write
++ obj.info()->addParam(obj, "labels", obj.m_labels); // modification: Make Read/Write
++ obj.info()->addParam(obj, "statistic", obj.m_statisticsMode)); // modification: Add parameter
++#endif
+
+ } // namespace KFaceIface
diff --git a/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.h b/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.h
new file mode 100644
index 00000000000..435a8a2aec3
--- /dev/null
+++ b/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_facerec_borrowed.h
@@ -0,0 +1,76 @@
+$NetBSD: patch-libkface_recognition-opencv-lbph_facerec_borrowed.h,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- libkface/recognition-opencv-lbph/facerec_borrowed.h.orig 2015-09-03 21:22:44.000000000 +0000
++++ libkface/recognition-opencv-lbph/facerec_borrowed.h
+@@ -45,7 +45,11 @@
+ namespace KFaceIface
+ {
+
++#if OPENCV_TEST_VERSION(3,0,0)
++class LBPHFaceRecognizer : public cv::face::FaceRecognizer
++#else
+ class LBPHFaceRecognizer : public cv::FaceRecognizer
++#endif
+ {
+ public:
+
+@@ -99,8 +103,13 @@ public:
+
+ ~LBPHFaceRecognizer() {}
+
++#if OPENCV_TEST_VERSION(3,0,0)
++ using cv::face::FaceRecognizer::save;
++ using cv::face::FaceRecognizer::load;
++#else
+ using cv::FaceRecognizer::save;
+ using cv::FaceRecognizer::load;
++#endif
+
+ static cv::Ptr<LBPHFaceRecognizer> create(int radius=1, int neighbors=8, int grid_x=8, int grid_y=8, double threshold = DBL_MAX, PredictionStatistics statistics = NearestNeighbor);
+
+@@ -139,6 +148,34 @@ public:
+ /**
+ * Getter functions.
+ */
++#if OPENCV_TEST_VERSION(3,0,0)
++
++ int getNeighbors() const { return m_neighbors; }
++ void setNeighbors(int _neighbors) { m_neighbors = _neighbors; }
++
++ int getRadius() const { return m_radius; }
++ void setRadius(int radius) { m_radius = radius; }
++
++ int getGrid_x() const { return m_grid_x; }
++ void setGrid_x(int _grid_x) { m_grid_x = _grid_x; }
++
++ int getGrid_y() const { return m_grid_y; }
++ void setGrid_y(int _grid_y) { m_grid_y = _grid_y; }
++
++ double getThreshold() const { return m_threshold; }
++ void setThreshold(double _threshold) { m_threshold = _threshold; }
++
++ void setHistograms(std::vector<cv::Mat> _histograms) { m_histograms = _histograms; }
++ std::vector<cv::Mat> getHistograms() const { return m_histograms; }
++
++ void setLabels(cv::Mat _labels) { m_labels = _labels; }
++ cv::Mat getLabels() const { return m_labels; }
++
++ void setStatistic(int _statistic) { m_statisticsMode = _statistic; }
++ int getStatistic() const { return m_statisticsMode; }
++
++#else
++
+ int neighbors() const { return m_neighbors; }
+ int radius() const { return m_radius; }
+ int grid_x() const { return m_grid_x; }
+@@ -147,6 +184,8 @@ public:
+ // NOTE: Implementation done through CV_INIT_ALGORITHM macro from OpenCV.
+ cv::AlgorithmInfo* info() const;
+
++#endif
++
+ private:
+
+ /** Computes a LBPH model with images in src and
diff --git a/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_lbphfacemodel.cpp b/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_lbphfacemodel.cpp
new file mode 100644
index 00000000000..f127b215649
--- /dev/null
+++ b/graphics/libkface/patches/patch-libkface_recognition-opencv-lbph_lbphfacemodel.cpp
@@ -0,0 +1,155 @@
+$NetBSD: patch-libkface_recognition-opencv-lbph_lbphfacemodel.cpp,v 1.1 2015/11/03 20:28:57 markd Exp $
+
+opencv3 support. https://bugs.kde.org/show_bug.cgi?id=349601
+
+--- libkface/recognition-opencv-lbph/lbphfacemodel.cpp.orig 2015-09-03 21:22:44.000000000 +0000
++++ libkface/recognition-opencv-lbph/lbphfacemodel.cpp
+@@ -61,7 +61,11 @@ LBPHFaceModel::LBPHFaceModel()
+ : cv::Ptr<LBPHFaceRecognizer>(LBPHFaceRecognizer::create()),
+ databaseId(0)
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ ptr()->setThreshold(100.0);
++#else
+ ptr()->set("threshold", 100.0);
++#endif
+ }
+
+ LBPHFaceModel::~LBPHFaceModel()
+@@ -80,9 +84,13 @@ LBPHFaceRecognizer* LBPHFaceModel::ptr()
+
+ const LBPHFaceRecognizer* LBPHFaceModel::ptr() const
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ const LBPHFaceRecognizer* const ptr = cv::Ptr<LBPHFaceRecognizer>::operator KFaceIface::LBPHFaceRecognizer*();
++#else
+ const LBPHFaceRecognizer* const ptr = cv::Ptr<LBPHFaceRecognizer>::operator const KFaceIface::LBPHFaceRecognizer*();
++#endif
+
+- if (!ptr)
++ if (!ptr)
+ kWarning() << "LBPHFaceRecognizer pointer is null";
+
+ return ptr;
+@@ -90,47 +98,83 @@ const LBPHFaceRecognizer* LBPHFaceModel:
+
+ int LBPHFaceModel::radius() const
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ return ptr()->getRadius();
++#else
+ return ptr()->get<int>("radius");
++#endif
+ }
+
+ void LBPHFaceModel::setRadius(int radius)
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ ptr()->setRadius(radius);
++#else
+ ptr()->set("radius", radius);
++#endif
+ }
+
+ int LBPHFaceModel::neighbors() const
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ return ptr()->getNeighbors();
++#else
+ return ptr()->get<int>("neighbors");
++#endif
+ }
+
+ void LBPHFaceModel::setNeighbors(int neighbors)
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ ptr()->setNeighbors(neighbors);
++#else
+ ptr()->set("neighbors", neighbors);
++#endif
+ }
+
+ int LBPHFaceModel::gridX() const
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ return ptr()->getGrid_x();
++#else
+ return ptr()->get<int>("grid_x");
++#endif
+ }
+
+ void LBPHFaceModel::setGridX(int grid_x)
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ ptr()->setGrid_x(grid_x);
++#else
+ ptr()->set("grid_x", grid_x);
++#endif
+ }
+
+ int LBPHFaceModel::gridY() const
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ return ptr()->getGrid_y();
++#else
+ return ptr()->get<int>("grid_y");
++#endif
+ }
+
+ void LBPHFaceModel::setGridY(int grid_y)
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ ptr()->setGrid_y(grid_y);
++#else
+ ptr()->set("grid_y", grid_y);
++#endif
+ }
+
+ OpenCVMatData LBPHFaceModel::histogramData(int index) const
+ {
++#if OPENCV_TEST_VERSION(3,0,0)
++ return OpenCVMatData(ptr()->getHistograms().at(index));
++#else
+ return OpenCVMatData(ptr()->get<std::vector<cv::Mat> >("histograms").at(index));
++#endif
+ }
+
+ QList<LBPHistogramMetadata> LBPHFaceModel::histogramMetadata() const
+@@ -168,12 +212,24 @@ void LBPHFaceModel::setHistograms(const
+ m_histogramMetadata << metadata;
+ }
+
++#if OPENCV_TEST_VERSION(3,0,0)
++ std::vector<cv::Mat> currentHistograms = ptr()->getHistograms();
++ cv::Mat currentLabels = ptr()->getLabels();
++#else
+ std::vector<cv::Mat> currentHistograms = ptr()->get<std::vector<cv::Mat> >("histograms");
+ cv::Mat currentLabels = ptr()->get<cv::Mat>("labels");
++#endif
++
+ currentHistograms.insert(currentHistograms.end(), newHistograms.begin(), newHistograms.end());
+ currentLabels.push_back(newLabels);
++
++#if OPENCV_TEST_VERSION(3,0,0)
++ ptr()->setHistograms(currentHistograms);
++ ptr()->setLabels(currentLabels);
++#else
+ ptr()->set("histograms", currentHistograms);
+- ptr()->set("labels", currentLabels);
++ ptr()->set("labels", currentLabels);
++#endif
+
+ /*
+ //Most cumbersome and inefficient way through a file storage which we were forced to use if we used standard OpenCV
+@@ -215,7 +271,11 @@ void LBPHFaceModel::update(const std::ve
+
+ // Update local information
+ // We assume new labels are simply appended
++#if OPENCV_TEST_VERSION(3,0,0)
++ cv::Mat currentLabels = ptr()->getLabels();
++#else
+ cv::Mat currentLabels = ptr()->get<cv::Mat>("labels");
++#endif
+
+ for (int i = m_histogramMetadata.size() ; i < currentLabels.rows ; i++)
+ {