Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 702354 - media-gfx/shotwell with media-libs/opencv-4.1.2 - ?
Summary: media-gfx/shotwell with media-libs/opencv-4.1.2 - ?
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Nicolas Bock
URL:
Whiteboard:
Keywords: EBUILD, PATCH
Depends on:
Blocks:
 
Reported: 2019-12-09 15:28 UTC by Helmut Jarausch
Modified: 2020-04-12 22:31 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild which applies a patch for opencv-4.1.2 (shotwell-0.31.0.ebuild,1.87 KB, text/plain)
2019-12-09 15:28 UTC, Helmut Jarausch
Details
patch for opencv-4.1.2 (shotwell-0.31.0-opencv4.patch,1.22 KB, patch)
2019-12-09 15:29 UTC, Helmut Jarausch
Details | Diff
shotwell-0.30.8_opencv4.patch (opencv4.patch,1.46 KB, patch)
2020-01-20 10:39 UTC, Charlie Gehlin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Jarausch 2019-12-09 15:28:23 UTC
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.
Comment 1 Helmut Jarausch 2019-12-09 15:29:03 UTC
Created attachment 598948 [details, diff]
patch for opencv-4.1.2
Comment 2 Jeroen Roovers gentoo-dev 2019-12-09 15:47:03 UTC
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.
Comment 3 Helmut Jarausch 2019-12-09 16:17:15 UTC
(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);
Comment 4 Jeremy Stent 2020-01-05 21:54:10 UTC
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.
Comment 5 Charlie Gehlin 2020-01-20 10:39:27 UTC
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.
Comment 6 Mart Raudsepp gentoo-dev 2020-02-24 20:55:55 UTC
Would be good to start off with an issue or MR filed to upstream: https://gitlab.gnome.org/GNOME/shotwell
Comment 7 alex 2020-04-12 22:31:46 UTC
(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!