Bug 376681

Summary: Region Coordinates Are Sometimes inf / Large Numbers
Product: [Applications] digikam Reporter: hardy.public
Component: Faces-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: 1127553236, caulier.gilles
Priority: NOR    
Version: 5.5.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 7.0.0
Attachments: After Box 1 is drawn
After Box 2 is drawn.
The metadata did not show
filter1
filter2
has metadata
has no metadata
windows5.5.0 version
parameters shown using exiv2

Description hardy.public 2017-02-19 17:10:14 UTC
Created attachment 104115 [details]
After Box 1 is drawn

About 30% of the time, after I draw the first face box (Jane) on an image, the metadata region coordinates written to the image are infinity.

Then when I draw a second box (Jim), Jane 1 is corrected but Jane is then repeated twice. Jane 2 and 3 coordinates are massive negative numbers.

Verification by another tool confirms it the metadata as inf.

See attached screenshots.
Comment 1 hardy.public 2017-02-19 17:11:16 UTC
Created attachment 104116 [details]
After Box 2 is drawn.
Comment 2 hardy.public 2017-02-19 17:23:38 UTC
If I clear the faces and try again, everything is normal.
Comment 3 hardy.public 2017-02-20 21:18:17 UTC
This happens with 5.4.0 too.
Comment 4 Yingjie Liu 2017-03-13 02:27:21 UTC
Created attachment 104531 [details]
The metadata did not show

Hi,
Could you please tell me how to open the metadata region in the last two attachment which shows the parameters about the region? After draw a face region, I clicked metadata action in the right-side bar, but I did not find the parameters about name and other parameters, show in this attachment. (Tracking the code is a good way, I tracked it but the code is a bit huge......)
Comment 5 caulier.gilles 2017-03-13 04:11:21 UTC
On top of metadata viewer, you have a button to setup tags filters. turn on all. Face tags are typically on XMP view.

Gilles Caulier
Comment 6 caulier.gilles 2017-03-13 04:16:18 UTC
FaceTags are managed in database here :

https://cgit.kde.org/digikam.git/tree/libs/database/tags

and stored in metadata by this method :

https://cgit.kde.org/digikam.git/tree/libs/dmetadata/dmetadata.cpp#n1659

Gilles Caulier
Comment 7 hardy.public 2017-03-13 08:32:27 UTC
The problem was first reported on the 15th Feb pre-release version of 5.5.0 and then confirmed in 5.4.0.

I was using the 11-March build of 5.5.0 pre-release yesterday and the problem did not happen. Maybe something was fixed by accident in this area in the March build.
Comment 8 Yingjie Liu 2017-03-15 08:56:22 UTC
Hi Gilles,
I set the filter as you said, click the tags filters, and turn on all in the Views and Behavior, as shown in the Attachment "filter1" and "filter2".
Then I installed mysql for the db reading and writing.
But I met three problems.
The first is some pictures have XMP metadata (see attachment "has metadata", I closed some filters in it, just left the useful ones), and some pictures have no XMP and other metadata (see attachment "has no metadata").
The second problem is that the XMP metadata about face tags is unavaliable, as shown in attachment "has metadata".
The third problem is that I installed 5.5.0 in windows, the "Last Keyword XMP" will show the face tag's name after I draw the box and click "Album->Write Metadata to Images", as shown in attachment "windows5.5.0 version". However, in ubuntu, I compiled the latest code and installed the software, draw the box, click "Album->Write Metadata to Images", the face tag's name still not shows in "Last Keyword XMP" view, the attachment "has metadata" shows the result.

I read the method storing the metadata that you posted two days ago:

https://cgit.kde.org/digikam.git/tree/libs/dmetadata/dmetadata.cpp#n1659

This method add the metadata of "Area","Regions" and "Region List" to XMP view. I found that the method is invoked by:

https://cgit.kde.org/digikam.git/tree/libs/fileactionmanager/metadatahub.cpp#n271

Then I debuged the program, and I found that the operations like create/modify face tags, write/read metadata from database or write/read tags from database, they all did not invoke the write method, therefore the setImageFacesMap can't be executed, so the XMP view has no data.

I don't know whether I missed some configurations of the software, if so, please indicate it for me. If there are some mistakes in my operations or I did not see the right code, please indicate it too. Thanks.

Yingjie Liu
Comment 9 Yingjie Liu 2017-03-15 08:56:53 UTC
Created attachment 104577 [details]
filter1
Comment 10 Yingjie Liu 2017-03-15 08:57:12 UTC
Created attachment 104578 [details]
filter2
Comment 11 Yingjie Liu 2017-03-15 08:57:32 UTC
Created attachment 104579 [details]
has metadata
Comment 12 Yingjie Liu 2017-03-15 08:57:49 UTC
Created attachment 104580 [details]
has no metadata
Comment 13 Yingjie Liu 2017-03-15 08:58:07 UTC
Created attachment 104581 [details]
windows5.5.0 version
Comment 14 Maik Qualmann 2017-03-15 19:56:37 UTC
Git commit 76060c16c14dabfb4aa7a5ac956c5292aff810bf by Maik Qualmann.
Committed on 15/03/2017 at 19:55.
Pushed by mqualmann into branch 'master'.

fix MetadataSynchronizer and non working lazy sync in digiKam-5.5.0

M  +1    -1    utilities/maintenance/maintenancedata.cpp

https://commits.kde.org/digikam/76060c16c14dabfb4aa7a5ac956c5292aff810bf
Comment 15 caulier.gilles 2017-03-18 14:39:13 UTC
Lui,

Under Linux, with last Maik patch applied to git master, this fix your problem to write metadata in image after to apply face tag ?

Gilles Caulier
Comment 16 Yingjie Liu 2017-03-18 15:09:26 UTC
Hi Gilles,
I tested Maik's patch under Ubuntu 16.04(x64). It solves the problem of writing metadata in image after applying face tag. The metadata shows in the right sidebar after I clicked "Album->Write Metadata to Images".
These days, I am looking at the "Unavailable" problem: The parameters in "Metadata Working Group Regions" such as "Area", "Name", "Region List" shows "Unavailable" even after drawing a tag box. I think, metadata part in digikam is a bigger part than the last two bugs(372342 and 351866). So far, I have read the code of how to show the metadata in XMP view, includes the class MetadataWidget, MetadataListView which showing the metadata, class SetUp, SetupMetadata, and MetadataPanel which is created after user click the button to setup tags filters, and these classes decide which item of metadata to show in the MetadataWidget. Next step, I think I have to look at the code which set the concrete parameters of "Area", "Name" and "Region List", and how they worked. I think this will find the reason why they shows "Unavailable".
Comment 17 caulier.gilles 2017-03-18 15:13:28 UTC
Exiv2 library is used in background to handle XMP tags. Exiv2 has a CLI tool to show metadata from the console. "exiv2 -px file.jpg" show any XMP tags ?

Gilles Caulier
Comment 18 Yingjie Liu 2017-03-18 15:22:11 UTC
Created attachment 104631 [details]
parameters shown using exiv2

Hi Gilles,
It shows the XMP tags after using "exiv2 -px file.jpg", as you can see in this attachment. But the parameters did not show in digikam(It is still Unavaliable). Is it because of my OS or some other reasons....
Comment 19 caulier.gilles 2017-08-15 18:11:23 UTC
Git commit 9b154ceeecb732ecb97d6900ab0841e643639f4e by Gilles Caulier.
Committed on 15/08/2017 at 18:06.
Pushed by cgilles into branch 'master'.

patch from Yingjie Liu for fix face tag region if image is rotated.
The tag region in database is not expected when rotate the image. The reason : function FaceGroup::aboutToSetInfo(const ImageInfo& info) in https://cgit.kde.org/digikam.git/tree/utilities/facemanagement/facegroup.cpp#n359 invoked applyItemGeometryChanges() after transformation. Before FaceGroup::aboutToSetInfo(const ImageInfo& info), the new coordination of tag region has been written into database. However, in applyItemGeometryChanges(), the tag region coordination of tag region will be change again in database which caused a wrong coordination.
A new FaceGroup::aboutToSetInfoAfterRotate(const ImageInfo& info) is now used instead of FaceGroup::aboutToSetInfo(const ImageInfo& info) which will not invoke applyItemGeometryChanges(). Then the coordination of tag region in database is true after image transformation.
Related: bug 326538, bug 381378

M  +4    -1    NEWS
M  +2    -1    app/views/imagepreviewview.cpp
M  +11   -0    utilities/facemanagement/facegroup.cpp
M  +2    -0    utilities/facemanagement/facegroup.h

https://commits.kde.org/digikam/9b154ceeecb732ecb97d6900ab0841e643639f4e
Comment 20 caulier.gilles 2019-12-23 15:15:27 UTC
Not reproducible with 7.0.0-beta1