Bug 262212 - Face recognition doesn't work
Summary: Face recognition doesn't work
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Recognition (show other bugs)
Version: 2.0.0
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-05 17:29 UTC by felix_mauch
Modified: 2018-09-02 15:18 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.0.0
Sentry Crash Report:


Attachments
The dialog stays like this. (48.30 KB, image/png)
2011-01-05 17:29 UTC, felix_mauch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description felix_mauch 2011-01-05 17:29:52 UTC
Created attachment 55617 [details]
The dialog stays like this.

Version:           2.0.0 (using Devel) 
OS:                Linux

When I scan my collection the faces are detected and the database is created. In a next step the faces should be recognized. However, the dialog just stays the same for a very long time.
The small bar is still moving around, but nothing happens.
I tried this after I tagged a person in a few images and wanted to see whether this person gets recognized in other pictures.

Reproducible: Always

Steps to Reproduce:
Run "Scan collection for faces" and select "Recognize faces". (see attachment)

Actual Results:  
Dialog gets stuck on first image.

Expected Results:  
Recognize detected faces.

I have a quit untouched fresh KDE SVN and freshly compiled digikam 2.0.0
Comment 1 Christoph Feck 2011-01-05 17:43:53 UTC
Could you verify your OpenCV installation as explained in bug 262074? It might be a duplicate.
Comment 2 felix_mauch 2011-01-05 17:58:48 UTC
My OpenCV installation does include haarcascades in /usr/share/opencv/haarcascades/

However, I read in the other bug report that digikam looks for them in /haarcascades for one user. How can I check where digikam looks for them on my installation?
Comment 3 caulier.gilles 2011-01-05 19:18:15 UTC
http://websvn.kde.org/branches/extragear/graphics/digikam/extra/libkface/libface/LibFace.h?revision=1206055&view=markup

line 74.

OPENCVDIR variable is provided by opencv config sets from package. It's filled by cmake script from opencv project at compile time.

If opencv package is not set properlly...

Gilles Caulier
Comment 4 felix_mauch 2011-01-05 22:15:21 UTC
Hm. I'm just wondering... line 68 says that standard value for this is /usr/share/opencv which is actually my installation. And the OpenCVConfig.cmake file is in there, as well.
So I don't really see where the problem is with that.
Comment 5 Gandalf Lechner 2011-01-06 10:17:25 UTC
Here is what face detection does on my machine (digikam 2.0 svn, kde 4.6 rc1 kubuntu, opencv 2.2 compiled from sources): The scanner works, and lists faces in the people/unknown tag, where I can assign the proper names to the faces. When browsing pictures in digikam, also the "show face tags" overlay icon works as expected, shows the registered faces, and gives me the possibility to enter names to faces which are recognized as faces but not yet associated with a name. What is not working however, is the "add a face tag" icon: Clicking it just doesn't do anything. What is it supposed to do? Draw a rectangle around a face and assign a tag?
Comment 6 LoneStar 2011-01-06 12:16:55 UTC
same behaviour as #5 for me
Comment 7 felix_mauch 2011-01-06 12:19:33 UTC
Well, that's another issue, but I think this has nothing to do with the recognition-stuff.
Comment 8 Marcel Wiesweg 2011-01-06 13:40:55 UTC
This is very simple: implementation is currently missing ;-) Yes I forgot a bit about that one.
Comment 9 Milan Knížek 2011-01-08 21:02:14 UTC
Hits me, too.
The popup window with information about scanning keeps on even after scanning completion. Faces are detected (/People/Unknown), but not recognised (I made a copy of image with manually assigned /People/John and rescanned the collection. The face on the image copy was detected but assigned with /People/Unknown).
Comment 10 Nigel Tummers 2011-01-28 14:33:17 UTC
I think i've got the same issues. Using latest kde & digikam svn builds with OpenCV 2.2.0-2 from arch repository.

Face detection works and faces are listed in People/Unknown.

But when I try to "Scan collection for faces" -> "Recognise faces" it completes in ~2 seconds (100 images) 
The thumbnail in the progress bar shows shows just a 'no image' thumbnail.
 
I get the following error (for each image) in the terminal:

OpenCV Error: Assertion failed (ssize.area() > 0) in resize, file /build/src/OpenCV-2.2.0/modules/imgproc/src/imgwarp.cpp, line 1391
digikam(1061)/KFACE: cv::Exception: /build/src/OpenCV-2.2.0/modules/imgproc/src/imgwarp.cpp:1391: error: (-215) ssize.area() > 0 in function resize
 
QImage::scaled: Image is a null image
Comment 11 Adam Spiers 2011-01-31 17:46:05 UTC
I see this too.  See also bug 262074.
Comment 12 caulier.gilles 2011-03-22 10:47:47 UTC
Git commit 948d0e560b5386539fd3bf1057fcb3d18683735f by Gilles Caulier.
Committed on 22/03/2011 at 10:48.
Pushed by cgilles into branch 'master'.

add a new static method to check if Cascade Open CV data dir exist (typically data files installed with OpenCV library)
CCBUGS: 262212

M  +19   -3    libkface/face.cpp     
M  +7    -3    libkface/face.h     

http://commits.kde.org/libkface/948d0e560b5386539fd3bf1057fcb3d18683735f
Comment 13 caulier.gilles 2011-03-22 11:03:06 UTC
Git commit 84e9d5350ffcb7ac4f3f5cb2faf5d8f058f3f8cb by Gilles Caulier.
Committed on 22/03/2011 at 11:02.
Pushed by cgilles into branch 'master'.

If OpenCV Haar Cascade dir do not exist in OpenCV installation path, show an error message box to bring user about this problem.
Note : if these files are not avaialble, Face detection and recognition don't work.
CCBUGS: 262212

M  +11   -12   digikam/main/digikamapp.cpp     

http://commits.kde.org/digikam/84e9d5350ffcb7ac4f3f5cb2faf5d8f058f3f8cb
Comment 14 Flavio 2011-04-26 22:04:02 UTC
I have the same problem yet Digikam looks for the right Haar Cascade dir.

Cascade directory located as : /usr/share/opencv/haarcascades
opened
OpenCV Error: Assertion failed (ssize.area() > 0) in resize, file /build/buildd/opencv2.2-2.2.0/modules/imgproc/src/imgwarp.cpp, line 1391
digikam(6608)/KFACE: cv::Exception: /build/buildd/opencv2.2-2.2.0/modules/imgproc/src/imgwarp.cpp:1391: error: (-215) ssize.area() > 0 in function resize
 
That folder contains all the cascades it should, so that's not the problem. I don't think that the directory is the problem, otherwise face detection wouldn't work either while it does.

So does recognition work for anyone, and if it does, could you tell from where you installed opencv and digikam?
Comment 15 Zack Evans 2011-12-05 23:58:51 UTC
So I think this fixed the Haar problem? But the "face recognition doesn't work" problem is still here. Maybe this should be marked a dupe of bug 271679?
Comment 16 caulier.gilles 2011-12-14 13:45:17 UTC

*** This bug has been marked as a duplicate of bug 271679 ***