Hello community,
here is the log from the commit of package libkface for openSUSE:Factory checked in at 2016-03-05 11:21:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libkface (Old)
and /work/SRC/openSUSE:Factory/.libkface.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libkface"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libkface/libkface.changes 2016-02-22 10:19:37.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libkface.new/libkface.changes 2016-03-05 11:21:34.000000000 +0100
@@ -1,0 +2,8 @@
+Thu Mar 3 13:23:36 UTC 2016 - tittiatcoke@gmail.com
+
+- Enable building against openCV 3.x
+ * opencv-3.1-support.patch Added from KDE Reviewboard
+- Drop fix-opencv.diff as this is no longer required with the newer
+ opencv
+
+-------------------------------------------------------------------
Old:
----
fix-opencv.diff
New:
----
opencv-3.1-support.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libkface.spec ++++++
--- /var/tmp/diff_new_pack.6qEPzI/_old 2016-03-05 11:21:35.000000000 +0100
+++ /var/tmp/diff_new_pack.6qEPzI/_new 2016-03-05 11:21:35.000000000 +0100
@@ -26,8 +26,9 @@
Version: 15.12.2
Release: 0
Source0: %{name}-%{version}.tar.xz
-Patch0: fix-opencv.diff
-BuildRequires: opencv-qt5-devel
+#PATCH-FIX-UPSTREAM opencv-3.1-support.patch -- Build with opencv 3.1
+Patch1: opencv-3.1-support.patch
+BuildRequires: opencv-qt5-devel > 3.0.0
BuildRequires: extra-cmake-modules
BuildRequires: kconfig-devel
BuildRequires: kdelibs4support-devel
@@ -42,10 +43,10 @@
%prep
%setup -q -n %{name}-%{version}
-%patch0 -p0
+%patch1 -p1
%build
- %cmake_kf5 -d build -- -DENABLE_OPENCV3=false
+ %cmake_kf5 -d build -- -DENABLE_OPENCV3=TRUE
%make_jobs
%install
++++++ opencv-3.1-support.patch ++++++
diff --git a/src/recognition-opencv-lbph/facerec_borrowed.h b/src/recognition-opencv-lbph/facerec_borrowed.h
index 27ad77a..f197d22 100644
--- a/src/recognition-opencv-lbph/facerec_borrowed.h
+++ b/src/recognition-opencv-lbph/facerec_borrowed.h
@@ -125,6 +125,8 @@ public:
*/
void update(cv::InputArrayOfArrays src, cv::InputArray labels);
+
+#if OPENCV_TEST_VERSION(3,1,0)
/**
* Predicts the label of a query image in src.
*/
@@ -134,6 +136,13 @@ public:
* Predicts the label and confidence for a given sample.
*/
void predict(cv::InputArray _src, int &label, double &dist) const;
+#else
+ using cv::face::FaceRecognizer::predict;
+ /*
+ * Predict
+ */
+ void predict(cv::InputArray src, cv::Ptrcv::face::PredictCollector collector, const int state = 0) const override;
+#endif
/**
* See FaceRecognizer::load().
diff --git a/src/recognition-opencv-lbph/facerec_borrowed.cpp b/src/recognition-opencv-lbph/facerec_borrowed.cpp
index 748691e..3c37ce2 100644
--- a/src/recognition-opencv-lbph/facerec_borrowed.cpp
+++ b/src/recognition-opencv-lbph/facerec_borrowed.cpp
@@ -36,6 +36,8 @@
*
* ============================================================ */
+#define QT_NO_EMIT
+
#include "facerec_borrowed.h"
// C++ includes
@@ -375,7 +377,11 @@ void LBPHFaceRecognizer::train(InputArrayOfArrays _in_src, InputArray _inm_label
}
}
+#if OPENCV_TEST_VERSION(3,1,0)
void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist) const
+#else
+void LBPHFaceRecognizer::predict(cv::InputArray _src, cv::Ptrcv::face::PredictCollector collector, const int state) const
+#endif
{
if(m_histograms.empty())
{
@@ -394,8 +400,12 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist
m_grid_y, /* grid size y */
true /* normed histograms */
);
+#if OPENCV_TEST_VERSION(3,1,0)
minDist = DBL_MAX;
minClass = -1;
+#else
+ collector->init((int)m_histograms.size(), state);
+#endif
// This is the standard method
@@ -406,11 +416,19 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist
{
double dist = compareHist(m_histograms[sampleIdx], query, CV_COMP_CHISQR);
+#if OPENCV_TEST_VERSION(3,1,0)
if((dist < minDist) && (dist < m_threshold))
{
minDist = dist;
minClass = m_labels.at<int>((int) sampleIdx);
}
+#else
+ int label = m_labels.at<int>((int) sampleIdx);
+ if (!collector->emit(label, dist, state))
+ {
+ return;
+ }
+#endif
}
}
@@ -422,7 +440,7 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist
// Create map "label -> vector of distances to all histograms for this label"
std::map