Bug 1246056

Summary: libkface: FTBFS against opencv3
Product: [Fedora] Fedora Reporter: Jozef Mlich <jmlich>
Component: libkfaceAssignee: Rex Dieter <rdieter>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: alekcejk, hhorak, jmlich83, kde-sig, kevin, rdieter, than
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-03 16:50:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1230078, 1254673    
Attachments:
Description Flags
libkface-15.04.2-opencv3.patch kevin: review+

Description Jozef Mlich 2015-07-23 11:55:25 UTC
Description of problem:
We are trying to recompile libkface with OpenCV 3.0.0. It seems, that OpenCV did some changes in Alogrithm class. The CV_INIT_ALGORITHM was completely removed. More details are described in OpenCV Transition Guide.

http://docs.opencv.org/master/db/dfa/tutorial_transition_guide.html

Complete build log is available in copr repository.

https://copr-be.cloud.fedoraproject.org/results/sergiomb/opencv/fedora-22-x86_64/libkface-15.04.0-1.fc22/build.log.gz

The upstream is already tracking this bug. I have started with development of the patch, but is seems I am not able to finish it in reasonable time. It is attached in upstream bugzilla.
https://bugs.kde.org/show_bug.cgi?id=349601

Comment 1 Kevin Kofler 2015-07-23 12:51:24 UTC
Maybe we need an opencv2 compat package? (But I'd rather have things ported to OpenCV 3 if possible.)

Comment 3 Jozef Mlich 2015-08-18 10:03:04 UTC
Heads up! There is a patch [1] from kungfujesus06 at KDE bugtracker [2].
I have tested it with our testing copr repository [3]. The libkface build succeeded.

[1] https://bugsfiles.kde.org/attachment.cgi?id=94088
[2] https://bugs.kde.org/show_bug.cgi?id=349601
[3] http://copr.fedoraproject.org/coprs/sergiomb/opencv/monitor/

Comment 4 Viktor Jancik 2015-08-18 16:32:35 UTC
Created attachment 1064375 [details]
libkface-15.04.2-opencv3.patch

I created a patch in parallel with kungfujesus06 and found an additional mistake.
Details are following...

Comment 5 Viktor Jancik 2015-08-18 16:43:42 UTC
https://bugzilla.redhat.com/attachment.cgi?id=1064375&action=diff#libkface-15.04.2/libkface/facedetector.cpp.opencv3_sec1

The haarcascade files are located in /usr/share/OpenCV/haarcascades, which can be seen by running:
rpm -ql opencv

If you have opencv version 3 installed.

However the original ${OpenCV_DIR} points to the base of the OpenCV library directory.
As described here: http://code.opencv.org/attachments/196/FindOpenCV.cmake
Specifically /usr/lib64/OpenCV

Instead, {OpenCV_SHARED} should be used which points to /usr/share/OpenCV as described here: https://github.com/Itseez/opencv/blob/master/cmake/OpenCVConfig.cmake

The values of these variables can be verified after building by looking at CMake Cache.txt

Additionally I changed the minimum required version to 3.0.0 because I am not sure if the changes also build for OpenCV version 2.4, this needs to be checked.
https://bugzilla.redhat.com/attachment.cgi?id=1064375&action=diff#libkface-15.04.2/CMakeLists.txt.opencv3_sec1

And lastly I included face.hpp instead of face/facerec.hpp but they include each other so it's the same.

https://bugzilla.redhat.com/attachment.cgi?id=1064375&action=diff#libkface-15.04.2/libkface/libopencv.h.cmake.in.opencv3_sec2


The successful build with these changes can be seen here:
https://copr.fedoraproject.org/coprs/vjancik/opencv3-deps/build/109623/

Comment 6 Kevin Kofler 2015-08-31 11:58:28 UTC
Comment on attachment 1064375 [details]
libkface-15.04.2-opencv3.patch

Putting a review flag on an entire SIG isn't that great an idea, as nobody feels responsible. ;-)

I'd say let's use this patch, can't be worse than a complete FTBFS, and it doesn't look too wrong. The only thing that worries me is the commenting out of the oldCascade workaround with no replacement.

Comment 7 Viktor Jancik 2015-09-01 10:29:27 UTC
It was the default reportee for libkface, I just left it like that.

If you look at the upstream bug tracker conversation, the latest patch (with the only change being the directory of the haarcascade files) doesn't crash, but it's not certain if the face detection feature in Digikam works properly.

Unless that is critical to us, I think having OpenCV 3 in Fedora outweights this error for now and we should apply the patch.

Comment 8 Kevin Kofler 2015-09-01 10:49:11 UTC
(removing the redundant CC, I'm already on kde-sig, I don't need to get the bug mail twice ;-) )

The thing is, face recognition is the one thing Digikam uses OpenCV to begin with. That said, the upstream report:
https://bugs.kde.org/show_bug.cgi?id=349601#c23
actually says that it seems to be working. But he hasn't tried with OpenCV 2, so we have no comparison on whether anything regressed. In particular, the false positives may or may not be a regression.

Comment 9 Than Ngo 2015-09-15 08:07:20 UTC
i full agree with kevin that we just use the patch, it is always better than a complete FTBFS.

Comment 10 Viktor Jancik 2015-10-13 14:02:00 UTC
A fix for this issue was released with Digikam version 4.14.0.

Could you update Libkface to the version bundled with Digikam 4.14.0 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 11 Jan Kurik 2016-02-24 13:27:44 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 12 Rex Dieter 2016-04-23 00:46:23 UTC
The supplied patch FTBFS :(

http://koji.fedoraproject.org/koji/taskinfo?taskID=13767569

That said, we could consider retiring (kde4) libkface, looks like the only thing needing it anymore is kphotoalbum, and there it is an optional dependency.

Comment 13 Rex Dieter 2016-05-02 13:40:30 UTC
updating target, summary.

I'll move to retire this in f25+