Bug 474357 - Face Tag area generated by Microsoft Photo Galery shown at wrong location in digiKam.
Summary: Face Tag area generated by Microsoft Photo Galery shown at wrong location in ...
Status: REPORTED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Engine (other bugs)
Version First Reported In: 8.1.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-10 08:56 UTC by joerg.meier
Modified: 2025-04-25 19:25 UTC (History)
4 users (show)

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


Attachments
Photo of the sea with sun - the sun should have a face tag (695.85 KB, image/jpeg)
2023-09-10 08:56 UTC, joerg.meier
Details
Same photo as before, now with additional tag (695.85 KB, image/jpeg)
2023-09-10 09:39 UTC, joerg.meier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description joerg.meier 2023-09-10 08:56:16 UTC
Created attachment 161531 [details]
Photo of the sea with sun - the sun should have a face tag

SUMMARY
For some of my photos the face-tags (generated by Microsoft Photo Galery) are not shown in the right location in the DigiKam-Preview.

STEPS TO REPRODUCE
1. Open the image attached in DigiKam Preview.
2. Select "Show Face Tags"

OBSERVED RESULT
The "sun"-Face-tag is shown on the water near to the bottom of the photo.

EXPECTED RESULT
The "sun"-Face-tag is shown on the sun near to the top of the photo.

SOFTWARE/OS VERSIONS
Windows: Win 10 

ADDITIONAL INFORMATION
- The photo is rotaed by meta-data. Could this be part of the problem? 
- For a lot of other photos the face tags are shown at the right loction.
- Without being able to prove this: I suspect that face-tags added by DigiKam are then displayed incorrectly in other sofware.
- The face tag for this photo is obviosly nonsense. But it does not violate any personal rights. ;)
Comment 1 Maik Qualmann 2023-09-10 09:10:16 UTC
This problem has been discussed many times before. In short, there is no standard whether the face coordinates are saved to the aligned or unaligned image. As a standard, many programs have emerged to assume the face coordinates for the unaligned image. Unfortunately, the Windows Photo Editor does it differently.

Maik
Comment 2 joerg.meier 2023-09-10 09:20:05 UTC
Dear Maik, Thank you for the quick reply and the clear description of the reason.
Comment 3 Maik Qualmann 2023-09-10 09:26:05 UTC
I want to add a detection from Microsoft Photo Tool. However, this sample image appears to have already been rotated as the orientation flag is set to normal. Can you upload an original image from Microsoft Photo?

Maik
Comment 4 joerg.meier 2023-09-10 09:39:20 UTC
Created attachment 161532 [details]
Same photo as before, now with additional tag

I manually added a secend face tag in "Windows Photo Gallery 2012" Build 16.4.3528.331. In the "Windows Photo Gallery 2012" the tag was added on the left hand side where water and sky meet. In DigiKam the Tag in shown on the right hand side of the picture.
Comment 5 Maik Qualmann 2023-09-10 15:56:08 UTC
Git commit 862032217ac8af283db5cae4e0f7f7c2b0a1adbf by Maik Qualmann.
Committed on 10/09/2023 at 17:54.
Pushed by mqualmann into branch 'master'.

add Microsoft Photo Editor detection for face region rotation
Related: bug 447674
FIXED-IN: 8.2.0

M  +1    -1    NEWS
M  +19   -2    core/libs/database/item/scanner/itemscanner_photo.cpp

https://invent.kde.org/graphics/digikam/-/commit/862032217ac8af283db5cae4e0f7f7c2b0a1adbf
Comment 6 joerg.meier 2023-09-10 17:41:06 UTC
Dear Maik, Sounds great! Thank you so much! Jörg
Comment 7 Maik Qualmann 2023-09-11 05:44:21 UTC
Git commit 3937123d76f2c1cc1b5aea0f3ab477a77355266e by Maik Qualmann.
Committed on 11/09/2023 at 07:43.
Pushed by mqualmann into branch 'master'.

revert Microsoft Photo Editor detection for face region rotation
Related: bug 447674

M  +2    -3    NEWS
M  +2    -19   core/libs/database/item/scanner/itemscanner_photo.cpp

https://invent.kde.org/graphics/digikam/-/commit/3937123d76f2c1cc1b5aea0f3ab477a77355266e
Comment 8 caulier.gilles 2023-10-15 03:05:39 UTC
@joerg.meier@vint.de,


This problem still reproducible with the new digiKam 8.2.0 pre-release Windows
installer available at usual place:

https://files.kde.org/digikam/

This new bundle is based on last Qt framework 5.15.11 and KDE framework 5.110.

Thanks in advance

Gilles Caulier
Comment 9 caulier.gilles 2025-04-07 05:31:53 UTC
Hi Joerg,

digiKam 8.6.0 is out with Maik fixes since a while. What's about this report using this release ?

Thanks in advance

Gilles Caulier
Comment 10 caulier.gilles 2025-04-11 18:13:45 UTC
Hi,

The 8.7.0 pre-release Windows installer from today have been rebuilt from
scratch with Qt 6.8.3, KDE 6.12, OpenCV 4.11 + CUDA support, Exiv2 0.28.5, ExifTool 13.27, ffmpeg 7, all image codecs updated to last version (jxl, avif, heif, aom, etc.).

Please try with this version to see if your problem still reproducible...

https://files.kde.org/digikam/

Thanks in advance
Best regards

Gilles Caulier
Comment 11 joerg.meier 2025-04-13 14:41:12 UTC
Dear Gilles,

I installed digiKam 8.6.0. It tool a (looong) while to update all the files and faces - but now all is up to date. When I now tag a face in digiKam in most images, it will show up fine in Photo Gallery. And the faces tagged in Photo Gallery are marked correctly in digiKam. But not for my test-image already uploaded to this thread. 

With Photo Gallery i added an additional tag "lower right" to the lower right corner (in addition to the other two "horizon on the left" and "Sun"). Then I moved this image to one of my digiKam album folders: The tag "lower right" shows up in the upper left corner, "horizon on the left" shows up on the right border and the "Sun" near the lower boundary. I have the impression, all tags are 180° rotated. 

Thank you for your support!

Jörg
Comment 12 joerg.meier 2025-04-13 14:56:13 UTC
Dear All,

I just downloaded and installed digiKam-8.7.0-20250413T130156-Qt6-Win64.exe.

The installation went fine. I also downloaded and installed the "Required Model Files". Then I did a restart of digiKam. 
Just for the record:  I did *no* update of my database (I also did *no* database update after updating to 8.6.0).

I deleted the file and added it from my backup (to avoid any effects from digiKam 8.6.0). In Photo Gallery I added another tag "min flare" and moved the image to my folder digiKam is watching as a album: Same effect as before: the tags seem 180° rotaed. 

Jörg
Comment 13 caulier.gilles 2025-04-13 18:15:33 UTC
Hi Jörg,

Interesting. Did you sync the database with file metadata to update the face region in the database and see the difference.
This is valid only for the file already imported in your collection of course...

Note: Michael Miller in CC here work currently on the Face workflow topic in digiKam.

Best 
Gilles Caulier
Comment 14 joerg.meier 2025-04-14 15:56:19 UTC
Dear Gilles,

> Interesting. Did you sync the database with file metadata to update the face region in the database and see the difference.
> This is valid only for the file already imported in your collection of course...

I deleted the image before opening digiKam and then open digiKam. Then digiKam removed the file from its album. After that I took the copy from my backup and tagged it anew. After that, I moved the image to the folder digiKam is watching as an album. Then digiKam found it.

I think digiKam is *not* just showing the old tags. Also due to the fact I added new ones (and the new ones are rotated as well). 

And: If I add a new tag in digiKam to *this* image, the tag will show up in PhotoGallery 180° rotated. In this regard, the behaviour is consistent. ;-)
For *many other* images, the tags are processed just fine between digiKam and Photo Gallery.

Jörg
Comment 15 Michael Miller 2025-04-25 12:26:06 UTC
Maik,
Can you please take a look at this?  I think it's something with the metadata in the file, or the way we are interpreting the tiff:Orientation tag.  There's nothing the face engine is doing with the data.  You know the metadata engine much better than I do.

Cheers,
Mike
Comment 16 Maik Qualmann 2025-04-25 19:25:16 UTC
Hi Michael,

The problem is that we don't know whether the face rectangles were saved relative to the aligned orientation or not. The metadata standard doesn't recommend this. Many programs, e.g., Picasa, save the face coordinates relative to the unaligned image. Microsoft saves them relative to the aligned image. You can't determine how it was saved based on the orientation flag or the width/height of the face rectangles.

However, we can identify MS Photo Editor based on its metadata; see my test in Comment 5.

However, we would then have to save the face rectangles compatible with MS Photo Editor when writing.

I don't see any other option; for performance reasons, I don't think we can do it with the face engine when scanning the images.

Maik