Red Hat Bugzilla – Bug 1254673
Digikam won't build with OpenCV version 3
Last modified: 2016-02-11 20:37:13 EST
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 depends on libkface, which is also incompatible with OpenCV 3 as it is right now in rawhide.
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:
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.
(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.
4.14.0. is built for f24, f23 and f22 
still falling 
-- libopencv found.......................... NO
digikam-5.0.0 presumably natively supports opencv (though I haven't tested it yet)
Note, requires build time cmake flag: -DENABLE_OPENCV3:BOOL=ON
Build of digikam-5.0.0-0.1.beta2.fc23.src.rpm succeeded for F23 and F22  .
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.
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,
/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: *** [core/libs/dimg/CMakeFiles/dimg_src.dir/filters/lens/lensfunfilter.cpp.o] Error 1
make: 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
digikam-5.0.0-beta3 is imported into rawhide, it should also include a fix for the aforementioned lensfunfilter issue