Bug 431964 - Face tags are not read correctly on certain images with more than one Microsoft People Tags XMP metadata
Summary: Face tags are not read correctly on certain images with more than one Microso...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Xmp (show other bugs)
Version: 7.1.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-23 00:35 UTC by José Oliver-Didier
Modified: 2021-01-24 20:20 UTC (History)
2 users (show)

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


Attachments
Sample images exhibiting issue. (1.53 MB, application/x-zip-compressed)
2021-01-23 00:35 UTC, José Oliver-Didier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description José Oliver-Didier 2021-01-23 00:35:23 UTC
Created attachment 135076 [details]
Sample images exhibiting issue.

SUMMARY
Digikam is unable to read face tags correctly on certain images with more than one Microsoft People Tags XMP in which some of the tags do not contain face regions (MPReg:Rectangle) and/or People's names (MPReg:PersonDisplayName). Sample images included as attachment.

STEPS TO REPRODUCE
1. Obtain a photo with multiple people tags in which only one has face regions added (Refer to XMP snipplet included below).
2. Add photo to Digikam catalog 
3. View photo in Digikam.

OBSERVED RESULT
- MS People tags are not read and displayed by Digikam.

EXPECTED RESULT
- MS People tags should be read and displayed by Digikam.

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
- It seems like an issue with certain images containing more that one People Tag in which some do not contain face coordinates (MPReg:Rectangle) and/or People's names (MPReg:PersonDisplayName). My guess is that the XMP is not being read properly.

The following XMP Snipplet obtained using Exiftool from test2.jpg. None of the 3 people tags are displayed in Digikam, note that only one has face regions( MPReg:Rectangle):

 <rdf:Description rdf:about='uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b'
  xmlns:MP='http://ns.microsoft.com/photo/1.2/'
  xmlns:MPRI='http://ns.microsoft.com/photo/1.2/t/RegionInfo#'
  xmlns:MPReg='http://ns.microsoft.com/photo/1.2/t/Region#'>
  <MP:RegionInfo rdf:parseType='Resource'>
   <MPRI:Regions>
    <rdf:Bag>
     <rdf:li rdf:parseType='Resource'>
      <MPReg:Rectangle>0.757813, 0.237776, 0.046094, 0.055609</MPReg:Rectangle>
     </rdf:li>
     <rdf:li rdf:parseType='Resource'>
      <MPReg:PersonDisplayName>Joseph Stallin</MPReg:PersonDisplayName>
     </rdf:li>
     <rdf:li rdf:parseType='Resource'>
      <MPReg:PersonDisplayName>Winston Churchill</MPReg:PersonDisplayName>
      <MPReg:Rectangle>0.211957, 0.265014, 0.051242, 0.062917</MPReg:Rectangle>
     </rdf:li>
     <rdf:li rdf:parseType='Resource'>
      <MPReg:PersonDisplayName>Harry Truman</MPReg:PersonDisplayName>
     </rdf:li>
    </rdf:Bag>
   </MPRI:Regions>
  </MP:RegionInfo>
 </rdf:Description>

- The MS People Tag schema allows for Region info items to contain a Rectangle region without an associated person's name as well as PersonDisplayName tags with no regions associated to it.
- Reference: Microsoft People Tags Schema Refence: https://docs.microsoft.com/en-us/windows/win32/wic/-wic-people-tagging#schema-reference
Comment 1 Maik Qualmann 2021-01-23 11:58:00 UTC
Git commit a3a4de03fc70e451b7f02f8318ae7090b6a6fcb8 by Maik Qualmann.
Committed on 23/01/2021 at 11:57.
Pushed by mqualmann into branch 'master'.

fix reading Microsoft People Tags XMP metadata
FIXED-IN: 7.2.0

M  +2    -1    NEWS
M  +2    -3    core/libs/metadataengine/dmetadata/dmetadata_faces.cpp

https://invent.kde.org/graphics/digikam/commit/a3a4de03fc70e451b7f02f8318ae7090b6a6fcb8
Comment 2 Maik Qualmann 2021-01-23 12:05:20 UTC
The person "Winston Churchill" is now assigned the correct facial region and tag. Likewise, the person "Joseph Stallin" has a face region but no name. People without valid face regions are not added as a tag. Same behavior as in Picasa. If a digiKam version with this patch is available, you will have to read the metadata again. It is recommended to temporarily activate the option to clean up the database in the digikam metata settings.

Maik
Comment 3 José Oliver-Didier 2021-01-24 20:20:42 UTC
Thanks Maik for your prompt response and fix!

This would still ignore tags with names without associated face regions, unless  if they are included within the digikam tag list (people/<name>) then they are recognized as people in digikam. Also, Digikam seems to ignore the IPTC Person shown in image lists. I opened bug 432048 as a related issue.