Created attachment 598946 [details] ebuild which applies a patch for opencv-4.1.2 The attached ebuild / patch works with the slightly newer version 0.31.0 but should be applied to older versions, as well.
Created attachment 598948 [details, diff] patch for opencv-4.1.2
It's common to not just provide the patch but to also describe and perhaps justify what it does, what problem it fixes, and so on.
(In reply to Jeroen Roovers from comment #2) > It's common to not just provide the patch but to also describe and perhaps > justify what it does, what problem it fixes, and so on. First, opencv installs opencv4.pc instead of opencv.pc Therefore one needs sed -i -e"s/'opencv',/'opencv4',/" subprojects/shotwell-facedetect/meson.build The enum CV_BGR2GRAY has been moved to the header imgproc/types_c.h therefore one needs @@ -1,6 +1,8 @@ #include "shotwell-facedetect.hpp" #include <opencv2/imgcodecs.hpp> +#include <opencv2/imgproc/types_c.h> + #define OPENFACE_RECOG_TORCH_NET "openface.nn4.small2.v1.t7" #define RESNET_DETECT_CAFFE_NET "res10_300x300_ssd_iter_140000_fp16.caffemodel" The enum CV_HAAR_SCALE_IMAGE has been renamed to cv::CASCADE_SCALE_IMAGE therefore one needs @@ -41,7 +43,7 @@ cv::resize(gray, smallImg, smallImgSize, 0, 0, cv::INTER_LINEAR); cv::equalizeHist(smallImg, smallImg); - cascade.detectMultiScale(smallImg, faces, 1.1, 2, CV_HAAR_SCALE_IMAGE, cv::Size(30, 30)); + cascade.detectMultiScale(smallImg, faces, 1.1, 2, cv::CASCADE_SCALE_IMAGE, cv::Size(30, 30)); } else { #ifdef HAS_OPENCV_DNN // DNN based face detection The function imread is now the cv namespace therefore @@ -159,7 +161,7 @@ std::vector<double> faceToVec(cv::String inputName) { std::vector<double> ret; - cv::Mat img = imread(inputName, 1); + cv::Mat img = cv::imread(inputName, 1); if (img.empty()) { std::cout << "error;Could not load the file to process. Filename: \"" << inputName << "\"" << std::endl; ret.assign(128, 0);
Thank you for the patch. They do not apply to the 30.8 ebuild currently available, but they served as a basis to let me get it to compile.
Created attachment 603792 [details, diff] shotwell-0.30.8_opencv4.patch Im not a code-ninja by any means, but this patch applies and compiles from local patches-directory.
Would be good to start off with an issue or MR filed to upstream: https://gitlab.gnome.org/GNOME/shotwell
(In reply to Charlie Gehlin from comment #5) > Created attachment 603792 [details, diff] [details, diff] > shotwell-0.30.8_opencv4.patch > > Im not a code-ninja by any means, but this patch applies and compiles from > local patches-directory. This patch worked great for me on shotwell-0.30.8 and opencv-4.1.2-r3. Thanks!
Thanks for providing this comprehensive information on this topic. https://bit.ly/3i8Bcp0
*** Bug 739642 has been marked as a duplicate of this bug. ***
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=029e7035530da87ddc163102e966eaab88eb189a commit 029e7035530da87ddc163102e966eaab88eb189a Author: Matt Turner <mattst88@gentoo.org> AuthorDate: 2022-04-05 01:19:00 +0000 Commit: Matt Turner <mattst88@gentoo.org> CommitDate: 2022-04-05 04:14:02 +0000 media-gfx/shotwell: Version bump to 0.30.15 - EAPI 8 - Allow vala-0.56 - Fix USE=opencv (bug #702354) - Fix build with dev-lang/python-exec[-native-symlinks] (bug #792168) Closes: https://bugs.gentoo.org/702354 Closes: https://bugs.gentoo.org/792168 Signed-off-by: Matt Turner <mattst88@gentoo.org> media-gfx/shotwell/Manifest | 1 + .../files/0.30.15-opencv4-compatibility.patch | 64 ++++++++++++++++ media-gfx/shotwell/shotwell-0.30.15.ebuild | 88 ++++++++++++++++++++++ 3 files changed, 153 insertions(+)