diff options
author | Andreas Sturmlechner <andreas.sturmlechner@gmail.com> | 2016-03-06 14:52:50 +0100 |
---|---|---|
committer | Michael Palimaka <kensington@gentoo.org> | 2016-03-08 02:07:43 +1100 |
commit | aab5a0522a2645f639cf0a3f6a419e05ccfff7d7 (patch) | |
tree | c43f18565612255b6187556dd6b574e7a66e79d1 /kde-apps/libkface | |
parent | kde-apps/libkface: Fix build with media-libs/opencv-3.1 (diff) | |
download | gentoo-aab5a0522a2645f639cf0a3f6a419e05ccfff7d7.tar.gz gentoo-aab5a0522a2645f639cf0a3f6a419e05ccfff7d7.tar.bz2 gentoo-aab5a0522a2645f639cf0a3f6a419e05ccfff7d7.zip |
kde-apps/libkface: Move 15.12.2 from tree
Fixes build with media-libs/opencv-3.1
Package-Manager: portage-2.2.27
Diffstat (limited to 'kde-apps/libkface')
-rw-r--r-- | kde-apps/libkface/Manifest | 1 | ||||
-rw-r--r-- | kde-apps/libkface/files/libkface-15.12.2-opencv3.1.patch | 167 | ||||
-rw-r--r-- | kde-apps/libkface/libkface-15.12.2.ebuild | 34 |
3 files changed, 202 insertions, 0 deletions
diff --git a/kde-apps/libkface/Manifest b/kde-apps/libkface/Manifest index 89d40502f408..cd0685456da9 100644 --- a/kde-apps/libkface/Manifest +++ b/kde-apps/libkface/Manifest @@ -2,3 +2,4 @@ DIST digikam-4.12.0.tar.bz2 69527960 SHA256 15043afb04733e059460165bc3cdf58dc42a DIST digikam-4.4.0.tar.bz2 68871203 SHA256 5c68a2d200f5b502706128ea64839319aad333fb79548f49ecc92594e280d4e9 SHA512 4992fad1e574fc44eac53f3ac8d4ab78ccbf8e04beb54a211a9afc20af1efb6f8bacedea07e403f490e7f70a74ed5ac02d4f9b939dfaf25f64a4a9bda0a7d94a WHIRLPOOL 7a05ab9926227232a1cf52bf68da45b849b982e840b171f702610acce85a1ce8e59967a02e845a0ef19c316daee835861573aca40dc7b28422cf7d6d56119e2c DIST libkface-15.08.3.tar.xz 8986224 SHA256 8f8314724f71041c4b3b6e2127ebaaddcfcf36415b20544740c4e11a5c203b4a SHA512 8be93902584a0bbb01d64b93f2f2b2dd0aa87ce1ec13d35d35f7f7d5f62b24214be8e0224d55eb82391cbd70b30d6a5d2799b4f1ab2b2c933254440cf12cd81f WHIRLPOOL f37568f2bbf5248e9ca3569782113d6bd425d509146c53eff3243bf716cfb9160cb4de372c4099ef934db73a8d0040c50c4e4df603e0fac905b78c3d92f4a122 DIST libkface-15.12.1.tar.xz 8987296 SHA256 c622d5fb44767182cfa39cce36719bdda69822538dcf0918b33ad7bec5f9d774 SHA512 95182f035f58827099a206e929c8b1b52d200ed2e657c7b958f800d9af8fe2ad40b920c3ca8142a6dd4e06f29bad4006154ca46ae930f9ebea7e83f85f689e88 WHIRLPOOL f35b401321a5ff29a598d9a1f0431b444dc12ce7c72c6a773d8056208ed5743e37cc50d0fbbb1152ff142d6118b9c738d14769098c7cf13e0c1ed929c0c92eb5 +DIST libkface-15.12.2.tar.xz 8987236 SHA256 e4b8420c63d8110a3c1e3a164fd6d1a5b3a264bc98d39aad1b19d9ce871af9a6 SHA512 ace531f6e82b05444735ae3360d5c7355b75d43dedf44e64cb85a15de0f9ca5b109038651e629eb0ab5f6811404fab332e6a93af37ebde5ce61e32e6a1b23340 WHIRLPOOL 5a5e9be3a317277bc47e1ceb9bb1988a347a644721b2b7448885045074280ad7abeb3f7ffebcff84f6e04b5c421ce0d91ab2b629e833fe091cc25023af7e7577 diff --git a/kde-apps/libkface/files/libkface-15.12.2-opencv3.1.patch b/kde-apps/libkface/files/libkface-15.12.2-opencv3.1.patch new file mode 100644 index 000000000000..b6d4c278f3d2 --- /dev/null +++ b/kde-apps/libkface/files/libkface-15.12.2-opencv3.1.patch @@ -0,0 +1,167 @@ +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::Ptr<cv::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::Ptr<cv::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<int, std::vector<int> > distancesMap; + +- for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) ++ for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) + { + double dist = compareHist(m_histograms[sampleIdx], query, CV_COMP_CHISQR); + std::vector<int>& distances = distancesMap[m_labels.at<int>((int) sampleIdx)]; +@@ -445,11 +463,18 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist + double mean = sum / it->second.size(); + s += QString::fromLatin1("%1: %2 - ").arg(it->first).arg(mean); + ++#if OPENCV_TEST_VERSION(3,1,0) + if((mean < minDist) && (mean < m_threshold)) + { + minDist = mean; + minClass = it->first; + } ++#else ++ if (!collector->emit(it->first, mean, state)) ++ { ++ return; ++ } ++#endif + } + + qCDebug(LIBKFACE_LOG) << s; +@@ -462,7 +487,7 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist + // map "label -> number of histograms" + std::map<int, int> countMap; + +- for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) ++ for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) + { + int label = m_labels.at<int>((int) sampleIdx); + double dist = compareHist(m_histograms[sampleIdx], query, CV_COMP_CHISQR); +@@ -480,7 +505,9 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist + scoreMap[it->second]++; + } + ++#if OPENCV_TEST_VERSION(3,1,0) + minDist = 0; ++#endif + QString s = QString::fromLatin1("Nearest Neighbor score: "); + + for (std::map<int,int>::iterator it = scoreMap.begin(); it != scoreMap.end(); ++it) +@@ -488,17 +515,26 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist + double score = double(it->second) / countMap.at(it->first); + s += QString::fromLatin1("%1/%2 %3 ").arg(it->second).arg(countMap.at(it->first)).arg(score); + ++#if OPENCV_TEST_VERSION(3,1,0) + if (score > minDist) + { + minDist = score; + minClass = it->first; + } ++#else ++ // large is better thus it is -score. ++ if (!collector->emit(it->first, -score, state)) ++ { ++ return; ++ } ++#endif + } + + qCDebug(LIBKFACE_LOG) << s; + } + } + ++#if OPENCV_TEST_VERSION(3,1,0) + int LBPHFaceRecognizer::predict(InputArray _src) const + { + int label; +@@ -506,6 +542,7 @@ int LBPHFaceRecognizer::predict(InputArray _src) const + predict(_src, label, dummy); + return label; + } ++#endif + + // Static method ---------------------------------------------------- + diff --git a/kde-apps/libkface/libkface-15.12.2.ebuild b/kde-apps/libkface/libkface-15.12.2.ebuild new file mode 100644 index 000000000000..a826543806f0 --- /dev/null +++ b/kde-apps/libkface/libkface-15.12.2.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +KDE_BLOCK_SLOT4="false" +inherit kde5 + +DESCRIPTION="Qt/C++ wrapper around LibFace to perform face recognition and detection" +HOMEPAGE="https://projects.kde.org/projects/kde/kdegraphics/libs/libkface" + +LICENSE="GPL-2" +KEYWORDS=" ~amd64 ~x86" +IUSE="" + +DEPEND=" + $(add_qt_dep qtgui) + $(add_qt_dep qtsql) + $(add_qt_dep qtwidgets) + $(add_qt_dep qtxml) + >=media-libs/opencv-3:=[contrib] +" +RDEPEND="${DEPEND}" + +PATCHES=( "${FILESDIR}/${P}-opencv3.1.patch" ) + +src_configure() { + local mycmakeargs=( + -DENABLE_OPENCV3=ON + ) + + kde5_src_configure +} |