1 |
commit: aab5a0522a2645f639cf0a3f6a419e05ccfff7d7 |
2 |
Author: Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Mar 6 13:52:50 2016 +0000 |
4 |
Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 7 15:07:43 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aab5a052 |
7 |
|
8 |
kde-apps/libkface: Move 15.12.2 from tree |
9 |
|
10 |
Fixes build with media-libs/opencv-3.1 |
11 |
|
12 |
Package-Manager: portage-2.2.27 |
13 |
|
14 |
kde-apps/libkface/Manifest | 1 + |
15 |
.../files/libkface-15.12.2-opencv3.1.patch | 167 +++++++++++++++++++++ |
16 |
kde-apps/libkface/libkface-15.12.2.ebuild | 34 +++++ |
17 |
3 files changed, 202 insertions(+) |
18 |
|
19 |
diff --git a/kde-apps/libkface/Manifest b/kde-apps/libkface/Manifest |
20 |
index 89d4050..cd06854 100644 |
21 |
--- a/kde-apps/libkface/Manifest |
22 |
+++ b/kde-apps/libkface/Manifest |
23 |
@@ -2,3 +2,4 @@ DIST digikam-4.12.0.tar.bz2 69527960 SHA256 15043afb04733e059460165bc3cdf58dc42a |
24 |
DIST digikam-4.4.0.tar.bz2 68871203 SHA256 5c68a2d200f5b502706128ea64839319aad333fb79548f49ecc92594e280d4e9 SHA512 4992fad1e574fc44eac53f3ac8d4ab78ccbf8e04beb54a211a9afc20af1efb6f8bacedea07e403f490e7f70a74ed5ac02d4f9b939dfaf25f64a4a9bda0a7d94a WHIRLPOOL 7a05ab9926227232a1cf52bf68da45b849b982e840b171f702610acce85a1ce8e59967a02e845a0ef19c316daee835861573aca40dc7b28422cf7d6d56119e2c |
25 |
DIST libkface-15.08.3.tar.xz 8986224 SHA256 8f8314724f71041c4b3b6e2127ebaaddcfcf36415b20544740c4e11a5c203b4a SHA512 8be93902584a0bbb01d64b93f2f2b2dd0aa87ce1ec13d35d35f7f7d5f62b24214be8e0224d55eb82391cbd70b30d6a5d2799b4f1ab2b2c933254440cf12cd81f WHIRLPOOL f37568f2bbf5248e9ca3569782113d6bd425d509146c53eff3243bf716cfb9160cb4de372c4099ef934db73a8d0040c50c4e4df603e0fac905b78c3d92f4a122 |
26 |
DIST libkface-15.12.1.tar.xz 8987296 SHA256 c622d5fb44767182cfa39cce36719bdda69822538dcf0918b33ad7bec5f9d774 SHA512 95182f035f58827099a206e929c8b1b52d200ed2e657c7b958f800d9af8fe2ad40b920c3ca8142a6dd4e06f29bad4006154ca46ae930f9ebea7e83f85f689e88 WHIRLPOOL f35b401321a5ff29a598d9a1f0431b444dc12ce7c72c6a773d8056208ed5743e37cc50d0fbbb1152ff142d6118b9c738d14769098c7cf13e0c1ed929c0c92eb5 |
27 |
+DIST libkface-15.12.2.tar.xz 8987236 SHA256 e4b8420c63d8110a3c1e3a164fd6d1a5b3a264bc98d39aad1b19d9ce871af9a6 SHA512 ace531f6e82b05444735ae3360d5c7355b75d43dedf44e64cb85a15de0f9ca5b109038651e629eb0ab5f6811404fab332e6a93af37ebde5ce61e32e6a1b23340 WHIRLPOOL 5a5e9be3a317277bc47e1ceb9bb1988a347a644721b2b7448885045074280ad7abeb3f7ffebcff84f6e04b5c421ce0d91ab2b629e833fe091cc25023af7e7577 |
28 |
|
29 |
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 |
30 |
new file mode 100644 |
31 |
index 0000000..b6d4c27 |
32 |
--- /dev/null |
33 |
+++ b/kde-apps/libkface/files/libkface-15.12.2-opencv3.1.patch |
34 |
@@ -0,0 +1,167 @@ |
35 |
+diff --git a/src/recognition-opencv-lbph/facerec_borrowed.h b/src/recognition-opencv-lbph/facerec_borrowed.h |
36 |
+index 27ad77a..f197d22 100644 |
37 |
+--- a/src/recognition-opencv-lbph/facerec_borrowed.h |
38 |
++++ b/src/recognition-opencv-lbph/facerec_borrowed.h |
39 |
+@@ -125,6 +125,8 @@ public: |
40 |
+ */ |
41 |
+ void update(cv::InputArrayOfArrays src, cv::InputArray labels); |
42 |
+ |
43 |
++ |
44 |
++#if OPENCV_TEST_VERSION(3,1,0) |
45 |
+ /** |
46 |
+ * Predicts the label of a query image in src. |
47 |
+ */ |
48 |
+@@ -134,6 +136,13 @@ public: |
49 |
+ * Predicts the label and confidence for a given sample. |
50 |
+ */ |
51 |
+ void predict(cv::InputArray _src, int &label, double &dist) const; |
52 |
++#else |
53 |
++ using cv::face::FaceRecognizer::predict; |
54 |
++ /* |
55 |
++ * Predict |
56 |
++ */ |
57 |
++ void predict(cv::InputArray src, cv::Ptr<cv::face::PredictCollector> collector, const int state = 0) const override; |
58 |
++#endif |
59 |
+ |
60 |
+ /** |
61 |
+ * See FaceRecognizer::load(). |
62 |
+diff --git a/src/recognition-opencv-lbph/facerec_borrowed.cpp b/src/recognition-opencv-lbph/facerec_borrowed.cpp |
63 |
+index 748691e..3c37ce2 100644 |
64 |
+--- a/src/recognition-opencv-lbph/facerec_borrowed.cpp |
65 |
++++ b/src/recognition-opencv-lbph/facerec_borrowed.cpp |
66 |
+@@ -36,6 +36,8 @@ |
67 |
+ * |
68 |
+ * ============================================================ */ |
69 |
+ |
70 |
++#define QT_NO_EMIT |
71 |
++ |
72 |
+ #include "facerec_borrowed.h" |
73 |
+ |
74 |
+ // C++ includes |
75 |
+@@ -375,7 +377,11 @@ void LBPHFaceRecognizer::train(InputArrayOfArrays _in_src, InputArray _inm_label |
76 |
+ } |
77 |
+ } |
78 |
+ |
79 |
++#if OPENCV_TEST_VERSION(3,1,0) |
80 |
+ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist) const |
81 |
++#else |
82 |
++void LBPHFaceRecognizer::predict(cv::InputArray _src, cv::Ptr<cv::face::PredictCollector> collector, const int state) const |
83 |
++#endif |
84 |
+ { |
85 |
+ if(m_histograms.empty()) |
86 |
+ { |
87 |
+@@ -394,8 +400,12 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist |
88 |
+ m_grid_y, /* grid size y */ |
89 |
+ true /* normed histograms */ |
90 |
+ ); |
91 |
++#if OPENCV_TEST_VERSION(3,1,0) |
92 |
+ minDist = DBL_MAX; |
93 |
+ minClass = -1; |
94 |
++#else |
95 |
++ collector->init((int)m_histograms.size(), state); |
96 |
++#endif |
97 |
+ |
98 |
+ // This is the standard method |
99 |
+ |
100 |
+@@ -406,11 +416,19 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist |
101 |
+ { |
102 |
+ double dist = compareHist(m_histograms[sampleIdx], query, CV_COMP_CHISQR); |
103 |
+ |
104 |
++#if OPENCV_TEST_VERSION(3,1,0) |
105 |
+ if((dist < minDist) && (dist < m_threshold)) |
106 |
+ { |
107 |
+ minDist = dist; |
108 |
+ minClass = m_labels.at<int>((int) sampleIdx); |
109 |
+ } |
110 |
++#else |
111 |
++ int label = m_labels.at<int>((int) sampleIdx); |
112 |
++ if (!collector->emit(label, dist, state)) |
113 |
++ { |
114 |
++ return; |
115 |
++ } |
116 |
++#endif |
117 |
+ } |
118 |
+ } |
119 |
+ |
120 |
+@@ -422,7 +440,7 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist |
121 |
+ // Create map "label -> vector of distances to all histograms for this label" |
122 |
+ std::map<int, std::vector<int> > distancesMap; |
123 |
+ |
124 |
+- for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) |
125 |
++ for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) |
126 |
+ { |
127 |
+ double dist = compareHist(m_histograms[sampleIdx], query, CV_COMP_CHISQR); |
128 |
+ std::vector<int>& distances = distancesMap[m_labels.at<int>((int) sampleIdx)]; |
129 |
+@@ -445,11 +463,18 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist |
130 |
+ double mean = sum / it->second.size(); |
131 |
+ s += QString::fromLatin1("%1: %2 - ").arg(it->first).arg(mean); |
132 |
+ |
133 |
++#if OPENCV_TEST_VERSION(3,1,0) |
134 |
+ if((mean < minDist) && (mean < m_threshold)) |
135 |
+ { |
136 |
+ minDist = mean; |
137 |
+ minClass = it->first; |
138 |
+ } |
139 |
++#else |
140 |
++ if (!collector->emit(it->first, mean, state)) |
141 |
++ { |
142 |
++ return; |
143 |
++ } |
144 |
++#endif |
145 |
+ } |
146 |
+ |
147 |
+ qCDebug(LIBKFACE_LOG) << s; |
148 |
+@@ -462,7 +487,7 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist |
149 |
+ // map "label -> number of histograms" |
150 |
+ std::map<int, int> countMap; |
151 |
+ |
152 |
+- for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) |
153 |
++ for(size_t sampleIdx = 0; sampleIdx < m_histograms.size(); sampleIdx++) |
154 |
+ { |
155 |
+ int label = m_labels.at<int>((int) sampleIdx); |
156 |
+ double dist = compareHist(m_histograms[sampleIdx], query, CV_COMP_CHISQR); |
157 |
+@@ -480,7 +505,9 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist |
158 |
+ scoreMap[it->second]++; |
159 |
+ } |
160 |
+ |
161 |
++#if OPENCV_TEST_VERSION(3,1,0) |
162 |
+ minDist = 0; |
163 |
++#endif |
164 |
+ QString s = QString::fromLatin1("Nearest Neighbor score: "); |
165 |
+ |
166 |
+ for (std::map<int,int>::iterator it = scoreMap.begin(); it != scoreMap.end(); ++it) |
167 |
+@@ -488,17 +515,26 @@ void LBPHFaceRecognizer::predict(InputArray _src, int &minClass, double &minDist |
168 |
+ double score = double(it->second) / countMap.at(it->first); |
169 |
+ s += QString::fromLatin1("%1/%2 %3 ").arg(it->second).arg(countMap.at(it->first)).arg(score); |
170 |
+ |
171 |
++#if OPENCV_TEST_VERSION(3,1,0) |
172 |
+ if (score > minDist) |
173 |
+ { |
174 |
+ minDist = score; |
175 |
+ minClass = it->first; |
176 |
+ } |
177 |
++#else |
178 |
++ // large is better thus it is -score. |
179 |
++ if (!collector->emit(it->first, -score, state)) |
180 |
++ { |
181 |
++ return; |
182 |
++ } |
183 |
++#endif |
184 |
+ } |
185 |
+ |
186 |
+ qCDebug(LIBKFACE_LOG) << s; |
187 |
+ } |
188 |
+ } |
189 |
+ |
190 |
++#if OPENCV_TEST_VERSION(3,1,0) |
191 |
+ int LBPHFaceRecognizer::predict(InputArray _src) const |
192 |
+ { |
193 |
+ int label; |
194 |
+@@ -506,6 +542,7 @@ int LBPHFaceRecognizer::predict(InputArray _src) const |
195 |
+ predict(_src, label, dummy); |
196 |
+ return label; |
197 |
+ } |
198 |
++#endif |
199 |
+ |
200 |
+ // Static method ---------------------------------------------------- |
201 |
+ |
202 |
|
203 |
diff --git a/kde-apps/libkface/libkface-15.12.2.ebuild b/kde-apps/libkface/libkface-15.12.2.ebuild |
204 |
new file mode 100644 |
205 |
index 0000000..a826543 |
206 |
--- /dev/null |
207 |
+++ b/kde-apps/libkface/libkface-15.12.2.ebuild |
208 |
@@ -0,0 +1,34 @@ |
209 |
+# Copyright 1999-2016 Gentoo Foundation |
210 |
+# Distributed under the terms of the GNU General Public License v2 |
211 |
+# $Id$ |
212 |
+ |
213 |
+EAPI=5 |
214 |
+ |
215 |
+KDE_BLOCK_SLOT4="false" |
216 |
+inherit kde5 |
217 |
+ |
218 |
+DESCRIPTION="Qt/C++ wrapper around LibFace to perform face recognition and detection" |
219 |
+HOMEPAGE="https://projects.kde.org/projects/kde/kdegraphics/libs/libkface" |
220 |
+ |
221 |
+LICENSE="GPL-2" |
222 |
+KEYWORDS=" ~amd64 ~x86" |
223 |
+IUSE="" |
224 |
+ |
225 |
+DEPEND=" |
226 |
+ $(add_qt_dep qtgui) |
227 |
+ $(add_qt_dep qtsql) |
228 |
+ $(add_qt_dep qtwidgets) |
229 |
+ $(add_qt_dep qtxml) |
230 |
+ >=media-libs/opencv-3:=[contrib] |
231 |
+" |
232 |
+RDEPEND="${DEPEND}" |
233 |
+ |
234 |
+PATCHES=( "${FILESDIR}/${P}-opencv3.1.patch" ) |
235 |
+ |
236 |
+src_configure() { |
237 |
+ local mycmakeargs=( |
238 |
+ -DENABLE_OPENCV3=ON |
239 |
+ ) |
240 |
+ |
241 |
+ kde5_src_configure |
242 |
+} |