Bug 292900

Summary: Some tags should have coordinates and be locatable on a photo (e. g. persons)
Product: [Applications] kphotoalbum Reporter: Tobias Leupold <tl>
Component: generalAssignee: KPhotoAlbum Bugs <kpabugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: johannes, luke-jr+kdebugs, s.dem, tl
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tobias Leupold 2012-01-30 20:08:08 UTC
Version:           unspecified (using KDE 4.7.4) 
OS:                Linux

I think it would not be bad if one could locate some tags on a photo. I'm thinking of what well-known social networks provide, marking some coordinates on the photo (e. g. a face) and tagging it as e. g. a person.

This would perhaps also be very handy when – one day – face detection will be availibe: like click on a face and get a list of proposed persons. If this would be possible, one could also feed a database with the so far tagged faces.

What do you think?

Reproducible: Always

Steps to Reproduce:
…

Actual Results:  
…

Expected Results:  
…
Comment 1 Miika Turkia 2012-02-08 15:06:40 UTC
This is one option for future development of KPA. libkface might provide us good API for detecting faces from photos and later on also recognition. However, I am not sure what is currently supported in this library and if it is being developed.
Comment 2 Johannes Zarl-Zierl 2013-05-22 22:12:01 UTC
*** Bug 223053 has been marked as a duplicate of this bug. ***
Comment 3 Johannes Zarl-Zierl 2013-05-22 22:13:18 UTC
*** Bug 170801 has been marked as a duplicate of this bug. ***
Comment 4 Tobias Leupold 2014-04-20 09:48:25 UTC
Is something going on about this? Even without automatic face detection or recognition, it would be fine if there was an option to make a tag locatable on the photo as a general improvement.
Comment 5 Tobias Leupold 2014-04-20 15:19:35 UTC
After some investigation, I found that – speaking of face detection – the work has kindly already been done by the opencv folks. Based on the Python "facedetect" script (see http://www.thregr.org/~wavexx/hacks/facedetect/ ), I easily created a quite minimalistic Python 2 script wrapping opencv's face detection machine and printing the coordinates of the faces found:

------------------------------
from math import sqrt
import cv2

CascadeClassifier = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml')
image = cv2.equalizeHist(cv2.imread('image.jpg', cv2.IMREAD_GRAYSCALE))
side = sqrt(image.size)
minlen = int(side / 20)
maxlen = int(side / 2)

for face in CascadeClassifier.detectMultiScale(image, 1.1, 4, cv2.cv.CV_HAAR_DO_CANNY_PRUNING, (minlen, minlen), (maxlen, maxlen)):
	print('{} {} {} {}'.format(*face))
------------------------------

I don't speak C++, but I think this could be used in KPA without much effort. Probably, libkface also already implements such a wrapper (I didn't find documentation for this).

So – the only thing that actually has to be added to KPA is the possibility to link a tag with coordinates.
Comment 6 Johannes Zarl-Zierl 2014-04-22 12:42:55 UTC
There is currently some ongoing work on this:
https://github.com/jzarl/kphotoalbum/pull/1
Comment 7 Johannes Zarl-Zierl 2014-06-21 17:59:23 UTC
Git commit 8869495c53f3ac43243a1e0474c4395bd81d209f by Johannes Zarl.
Committed on 21/06/2014 at 17:16.
Pushed by johanneszarl into branch 'positionable_tags-cleanedup2'.

GUI-Changes for implementing positionable tags.

Original patchset by Tobias Leupold.
This patchset also reimplements handling of image rotation in the
AnnotationDialog, fixing bug #336094.
Related: bug 336094

M  +248  -8    AnnotationDialog/Dialog.cpp
M  +19   -2    AnnotationDialog/Dialog.h
M  +281  -26   AnnotationDialog/ImagePreview.cpp
M  +45   -4    AnnotationDialog/ImagePreview.h
M  +37   -0    AnnotationDialog/ImagePreviewWidget.cpp
M  +6    -0    AnnotationDialog/ImagePreviewWidget.h
M  +53   -5    AnnotationDialog/ListSelect.cpp
M  +14   -2    AnnotationDialog/ListSelect.h
A  +420  -0    AnnotationDialog/ResizableFrame.cpp     [License: UNKNOWN]  *
A  +60   -0    AnnotationDialog/ResizableFrame.h     [License: UNKNOWN]  *
M  +3    -1    CMakeLists.txt
M  +14   -6    MainWindow/Window.cpp
M  +1    -0    MainWindow/Window.h
M  +3    -2    Viewer/ImageDisplay.cpp
M  +1    -0    Viewer/ImageDisplay.h
M  +6    -0    Viewer/InfoBox.cpp
M  +4    -0    Viewer/InfoBox.h
A  +54   -0    Viewer/TaggedArea.cpp     [License: UNKNOWN]  *
A  +33   -0    Viewer/TaggedArea.h     [License: UNKNOWN]  *
M  +117  -0    Viewer/ViewerWidget.cpp
M  +5    -0    Viewer/ViewerWidget.h

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/kphotoalbum/8869495c53f3ac43243a1e0474c4395bd81d209f
Comment 8 Johannes Zarl-Zierl 2014-06-23 21:46:58 UTC
Git commit ed792aec09c1df9c4f700e87c356f0a454f5cde6 by Johannes Zarl.
Committed on 22/06/2014 at 23:10.
Pushed by johanneszarl into branch 'master'.

GUI-Changes for implementing positionable tags.

Original patchset by Tobias Leupold.
This patchset also reimplements handling of image rotation in the
AnnotationDialog, fixing bug #336094.
Related: bug 336094

M  +248  -8    AnnotationDialog/Dialog.cpp
M  +19   -2    AnnotationDialog/Dialog.h
M  +283  -26   AnnotationDialog/ImagePreview.cpp
M  +40   -3    AnnotationDialog/ImagePreview.h
M  +37   -0    AnnotationDialog/ImagePreviewWidget.cpp
M  +6    -0    AnnotationDialog/ImagePreviewWidget.h
M  +53   -5    AnnotationDialog/ListSelect.cpp
M  +14   -2    AnnotationDialog/ListSelect.h
A  +420  -0    AnnotationDialog/ResizableFrame.cpp     [License: UNKNOWN]  *
A  +60   -0    AnnotationDialog/ResizableFrame.h     [License: UNKNOWN]  *
M  +4    -2    CMakeLists.txt
M  +14   -6    MainWindow/Window.cpp
M  +1    -0    MainWindow/Window.h
M  +3    -2    Viewer/ImageDisplay.cpp
M  +1    -0    Viewer/ImageDisplay.h
M  +6    -0    Viewer/InfoBox.cpp
M  +4    -0    Viewer/InfoBox.h
A  +54   -0    Viewer/TaggedArea.cpp     [License: UNKNOWN]  *
A  +33   -0    Viewer/TaggedArea.h     [License: UNKNOWN]  *
M  +117  -0    Viewer/ViewerWidget.cpp
M  +5    -0    Viewer/ViewerWidget.h

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/kphotoalbum/ed792aec09c1df9c4f700e87c356f0a454f5cde6
Comment 9 Tobias Leupold 2014-08-31 21:57:18 UTC
Introduced in KPhotoAlbum 4.5 :-)