Bug 1254673 - Digikam won't build with OpenCV version 3
Digikam won't build with OpenCV version 3
Product: Fedora
Classification: Fedora
Component: digikam (Show other bugs)
All Linux
unspecified Severity medium
: ---
: ---
Assigned To: Steven M. Parrish
Fedora Extras Quality Assurance
Depends On: 1246056 digikam-5.0
Blocks: opencv3
  Show dependency treegraph
Reported: 2015-08-18 11:49 EDT by Viktor Jancik
Modified: 2016-02-11 20:37 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-02-11 20:37:13 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
digikam-4.12.0-opencv3.patch (5.55 KB, patch)
2015-08-18 13:12 EDT, Viktor Jancik
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
KDE Software Compilation 349601 None None None Never

  None (edit)
Description Viktor Jancik 2015-08-18 11:49:33 EDT
Description of problem:
Digikam is dependent on OpenCV and Fedora is migrating to OpenCV 3.
However digikam isn't compatible with OpenCV 3 and uses some functionality that didn't make it to OpenCV 3 from OpenCV 2.4

Version-Release number of selected component (if applicable):
digikam 4.12.0
Comment 1 Viktor Jancik 2015-08-18 11:56:29 EDT
Digikam depends on libkface, which is also incompatible with OpenCV 3 as it is right now in rawhide.
Comment 2 Viktor Jancik 2015-08-18 13:12:20 EDT
Created attachment 1064382 [details]

Fixes the issue.

cvCreateMat returns cvMat but variable d is of type Mat, a 1 to 1 replacement was possible with the Mat constructor.
In core/libs/database/imgqsort/imgqsort.cpp vector containers were missing the std:: namespace prefix. How did it build before?
In extra/kipi-plugins/removeredeyes/detection/locators/haarclassifier/haarclassifierlocator.cpp I had to add a definition of cvFillImage because it was removed from OpenCV 3. The definition is exactly the same as it was in OpenCV 2.4.11.
I had to conditionally disable the building of ipptest because it used a function that no longer exists in OpenCV 3 (cvGetModuleInfo) and I couldn't find / create a replacement. As a consequence, I am not sure if the tests pass properly, because I am not sure if this is a good way to disable a test.
And lastly, I had to modify the includes in 2 libopencv.h files and modify the OPENCV_TEST_VERSION macros as they didn't work as intended for versions 2.3.0 up to 2.4.X Yes, there are two libopencv.h files.

Successful build with these changes can be seen here:
Comment 3 Viktor Jancik 2015-10-13 10:01:00 EDT
A fix for this issue was released with Digikam version 4.14.0.

Could you update Digikam to that version in Rawhide?

Reportedly, there is information on a new compile option in the libkface README.txt file, which let's you choose between OpenCV3 and OpenCV2 for backwards compatibility.
Comment 4 nucleo 2015-10-13 12:25:59 EDT
(In reply to Viktor Jancik from comment #3)
> A fix for this issue was released with Digikam version 4.14.0.

4.14.0 sources not available yet http://download.kde.org/stable/digikam/
When tarball will be available it will be built for Rawhide.
Comment 5 Sergio Monteiro Basto 2015-11-26 08:42:58 EST
Victor , 
 4.14.0. is built for f24, f23 and f22 [1]

[1] http://koji.fedoraproject.org/koji/packageinfo?packageID=1593
Comment 6 Sergio Monteiro Basto 2015-11-26 09:13:41 EST
still falling [1] 

--  libopencv found.......................... NO

Comment 7 Rex Dieter 2015-12-30 19:24:43 EST
digikam-5.0.0 presumably natively supports opencv (though I haven't tested it yet)
Comment 8 Rex Dieter 2016-01-05 07:56:54 EST
Note, requires build time cmake flag:  -DENABLE_OPENCV3:BOOL=ON
Comment 9 Sergio Monteiro Basto 2016-01-07 14:26:46 EST
Build of digikam-5.0.0-0.1.beta2.fc23.src.rpm succeeded for F23 and F22 [1] .
kf5-libkface and digikam needs add -DENABLE_OPENCV3:BOOL=ON in .spec to build. 

I have also build kf5-libkdcraw, kf5-libksane,  kf5-libkface, kf5-libkipi before.

[1] https://copr.fedoraproject.org/coprs/sergiomb/opencv/build/152093/

Build of digikam fails in rawhide in lensfunfilter.cpp : 

In file included from /builddir/build/BUILD/digikam-5.0.0-beta2/core/libs/dimg/filters/lens/lensfuniface.h:29:0,
                 from /builddir/build/BUILD/digikam-5.0.0-beta2/core/libs/dimg/filters/lens/lensfunfilter.cpp:32:
/usr/include/lensfun/lensfun.h:2506:5: error: template with C linkage
     template<typename T> static void ModifyColor_Vignetting_PA (
/usr/include/lensfun/lensfun.h:2508:5: error: template with C linkage
     template<typename T> static void ModifyColor_DeVignetting_PA (
core/libs/dimg/CMakeFiles/dimg_src.dir/build.make:2465: recipe for target 'core/libs/dimg/CMakeFiles/dimg_src.dir/filters/lens/lensfunfilter.cpp.o' failed
make[2]: *** [core/libs/dimg/CMakeFiles/dimg_src.dir/filters/lens/lensfunfilter.cpp.o] Error 1
make[2]: Leaving directory '/builddir/build/BUILD/digikam-5.0.0-beta2/x86_64-redhat-linux-gnu'
CMakeFiles/Makefile2:2797: recipe for target 'core/libs/dimg/CMakeFiles/dimg_src.dir/all' failed
Comment 11 Rex Dieter 2016-02-11 20:37:13 EST
digikam-5.0.0-beta3 is imported into rawhide, it should also include a fix for the aforementioned lensfunfilter issue

Note You need to log in before you can comment on or make changes to this bug.