Summary: | Write out face rectangles to XMP file | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Leif Huhn <lb.kdebugzilla> |
Component: | Faces-Engine | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | anantapalani, caulier.gilles, domlyons, felix.leif, harry, nick.andrik, veaceslav.munteanu90 |
Priority: | NOR | ||
Version: | 2.0.0 | ||
Target Milestone: | --- | ||
Platform: | Unlisted Binaries | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 3.3.0 | |
Sentry Crash Report: | |||
Attachments: |
This is a photo with one photo tag position around the face in windows photo gallery
Here is another image tagged in Windows Live Photo Gallery, this one is slightly different as it includes email address as well as names. Photo tagged with test program implementing Live Photo tagging Here's a screenshot of test photo in Windows Photo Gallery Tagged photo No tags Jpeg tagged Jpeg tagged 2 |
Description
Leif Huhn
2011-07-09 18:57:23 UTC
*** This bug has been marked as a duplicate of bug 271030 *** Reopening this bug: (solved) 271030 implemented importing Window Live gallery tags, but writing digikam faces to metadata is not implemented. Leif, As with bug 271030, you are welcome to provide patch to write face tag in XMP Window Live gallery tags. Thanks in advance for your help. Gilles Caulier Hi Does digikam still not write facetags to image files? Thanks, Harry I think digikam still does not write face info in XMP.MP tags: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Microsoft.html#MP If what you need is a patch for that, could you please give me a pointer on where to check (in digikam code) in order to add it? Thanks! In libs/dmetadata/dmetadata.cpp, there is a method DMetadata::getImageFacesMap which implements the reading part. First step would be to implement the writing part here. Nick, Thanks to contribute. As Marcel said look in this method : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/dmetadata/dmetadata.cpp#L1217 Gilles Caulier Hi all, i am interested too and will install the toolchain again to test this functionality if related changes are commited. Regards Felix Leif There is also a XMP schema from the Metadata Working Group. At http://www.metadataworkinggroup.org/specs/ you find the spec (page 59 of the pdf) and test files. The specification also gives hints about resizing, rotation and so on, although this probably is out of focus at the moment. Exiv2 supports the mwg-rg schema and it seems very similar to the MP schema (both use normalized values). So maybe it would be possible to write both schemes with only little additional effort. Rotation is important, faces are recognized in "correct" rotation which can differ from pixel arrangement in the file, so the standard must define the applicable rotation. Can you please also tell me where to call this function from? (I guess chosen by a checkbox in geolocation window just as "write tags to XMP") Oops, ignore the comment in parentheses, it was for another bug. But the question is still valid: when should I call the writeFaces function (just for testing). Thanks Nick, Some words about DMetadata::getImageFacesMap(). As Marcel said, it's read Face Tags registered in image metadata to populate digiKam database. It's used here : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/database/imagescanner.cpp#L593 ImageScanner class is used when a new items is detected on collection. Whole image metadata are scanned... As you can see in this method, there are 3 classes used to manage faces on DB : - FaceTags : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/database/faces/facetags.h - FaceTagsEditor : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/database/faces/facetagseditor.h - TagRegion : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/database/core/tagregion.h Now about future DMetadata::setImageFacesMap(), the complete goal to implement is not trivial. You need to patch a lots of place in digiKam, including setup metadata dialog. - The lead class used to write and update metadata to image and DB, is MetadatHub https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/digikam/fileaction/metadatahub.h This class manage the way to update metadata in file accordingly with digiKam Metadata Setup options set by end users in config dialog : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/setup/setupmetadata.cpp .. where a new option need to be add to handle face writing stuff... But in the first way, you need to write DMetadata::setImageFacesMap(). Do hack it, i recommend to write a small test command line program as some exist here : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/show/tests We have already written test program for libkexiv2 (DMetadata is a drivated class of KExiv2). As your new method will be introduced in digiKam core, you cannot set this test program in libkexiv2, but you can take inspiration from existing test program from Kexiv2 here : https://projects.kde.org/projects/kde/kdegraphics/libs/libkexiv2/repository/revisions/master/show/test Only after to have finalized DMetadata::setImageFacesMap(), the rest of digiKam metadata stuff need to be patched. Gilles Caulier *** This bug has been confirmed by popular vote. *** Hello. I'm working on this bug. Indeed it's more complex that it looks like. For now I tried to hack setImagesFaceTags() but it was a little complicated. It seem that I'm unable to use just libkexiv2, I had to use exiv2 itself and set up a new method for libkexiv2. I don't know if it's ok like this, but here is the result. Look at my last commit: https://github.com/veaceslav/Exiv2-hacking/commits/master Please review if you can. A bigger patch with digikam this method integrated is coming, but for now I'm going to sleep :) Hello, this is my first patch. https://git.reviewboard.kde.org/r/109087/ Please review it and give me you opinion Thank you, Veaceslav Veaceslav, Do you see this comment about face tags from Picasa and an open source application named PicFace : https://bugs.kde.org/show_bug.cgi?id=217991#c4 Gilles Caulier Veaceslav, See also this entry : https://bugs.kde.org/show_bug.cgi?id=313190 Gilles Caulier Thank you Gilles, for now I should implement: 1. Auto-rotate picassa tags according to exif tag 2. Trigger metadata write when tag updated 3. Rotate tags when image is rotated by exif flag(now only rotates when image itself is rotated) Still so much to do... Hello, picassafacetag brach was merged into master: http://quickgit.kde.org/?p=digikam.git&a=commit&h=0e69485123b1a4938e2c338a9c5142972b89bf82 Now, digiKam can both read/write/update face tags :) Also, this option is disabled by default and you need to enable it from settings-»metadata. Nothing bad should happen, but I recommend to begin testing with a small collection :) Hi Just tried this using digikam 3.4.0 for Windows. I just wanted to clarify whether digikam is writing faces in the same metadata format it is reading them? Currently if I write a face tag in Windows Live Photo Gallery, digikam will recognise it as per bug 271030, but when I set digikam to write face tags as per this bug, a normal tag is detected in Windows Live Photo Gallery, but a people tag is not? Just wanted to clarify. Thanks, Harry Do you have write face tags from digiKam settings enabled? Also, can you provide me some photos tagged with Windows Live photo? Created attachment 82982 [details]
This is a photo with one photo tag position around the face in windows photo gallery
Yes, I do have the write setting enabled.
Here is one sample image from Windows Photo Gallery
Created attachment 82983 [details]
Here is another image tagged in Windows Live Photo Gallery, this one is slightly different as it includes email address as well as names.
This one has two faces in it, the details contained in each tag are typed under the tagged area.
Ok... Writting face rectangles was implemented by me, and it only supports Metadata Speciafications (also used in Picassa): Xmp.mwg-rs.Regions/mwg-rs:RegionList XmpText 0 type="Bag" Xmp.mwg-rs.Regions/mwg-rs:RegionList[1] XmpText 0 type="Struct" Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Name XmpText 6 Mihnea Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Type XmpText 4 Face Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area XmpText 0 type="Struct" Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:x XmpText 8 0.746528 Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:y XmpText 7 0.26196 Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:w XmpText 8 0.255916 Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:h XmpText 8 0.489198 Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:unit XmpText 10 normal And here is what Window want to see: Xmp.MP.RegionInfo XmpText 0 type="Struct" Xmp.MP.RegionInfo/MPRI:Regions XmpText 0 type="Bag" Xmp.MP.RegionInfo/MPRI:Regions[1] XmpText 0 type="Struct" Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:Rectangle XmpText 38 0.438073, 0.301923, 0.185780, 0.311538 Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:PersonDisplayName XmpText 12 Example Face Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:PersonEmailDigest XmpText 40 E43A0343081CABFE3D1ED5C9F414B68E9F1D7EF8 Xmp.MP.RegionInfo/MPRI:Regions[2] XmpText 0 type="Struct" Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:Rectangle XmpText 38 0.126147, 0.232692, 0.178899, 0.300000 Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:PersonDisplayName XmpText 3 Bob Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:PersonEmailDigest XmpText 40 F4F6C938D35ACA3A4B5EBFD68A2A4B207EB327EE Xmp.xmpMM.InstanceID XmpText 41 uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b Above all, I like the encrypted email :) (In reply to comment #25) > Ok... Writting face rectangles was implemented by me, and it only supports > Metadata Speciafications (also used in Picassa): > > Xmp.mwg-rs.Regions/mwg-rs:RegionList XmpText 0 type="Bag" > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1] XmpText 0 type="Struct" > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Name XmpText 6 Mihnea > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Type XmpText 4 Face > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area XmpText 0 > type="Struct" > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:x XmpText 8 > 0.746528 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:y XmpText 7 > 0.26196 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:w XmpText 8 > 0.255916 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:h XmpText 8 > 0.489198 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:unit XmpText > 10 normal > > And here is what Window want to see: > > Xmp.MP.RegionInfo XmpText 0 type="Struct" > Xmp.MP.RegionInfo/MPRI:Regions XmpText 0 type="Bag" > Xmp.MP.RegionInfo/MPRI:Regions[1] XmpText 0 type="Struct" > Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:Rectangle XmpText 38 0.438073, > 0.301923, 0.185780, 0.311538 > Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:PersonDisplayName XmpText 12 > Example Face > Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:PersonEmailDigest XmpText 40 > E43A0343081CABFE3D1ED5C9F414B68E9F1D7EF8 > Xmp.MP.RegionInfo/MPRI:Regions[2] XmpText 0 type="Struct" > Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:Rectangle XmpText 38 0.126147, > 0.232692, 0.178899, 0.300000 > Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:PersonDisplayName XmpText 3 Bob > Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:PersonEmailDigest XmpText 40 > F4F6C938D35ACA3A4B5EBFD68A2A4B207EB327EE > Xmp.xmpMM.InstanceID XmpText 41 > uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b > > Above all, I like the encrypted email :) In case you didn't see the specification: http://msdn.microsoft.com/en-us/library/windows/desktop/ee719905%28v=vs.85%29.aspx (In reply to comment #25) > Ok... Writting face rectangles was implemented by me, and it only supports > Metadata Speciafications (also used in Picassa): > > Xmp.mwg-rs.Regions/mwg-rs:RegionList XmpText 0 type="Bag" > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1] XmpText 0 type="Struct" > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Name XmpText 6 Mihnea > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Type XmpText 4 Face > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area XmpText 0 > type="Struct" > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:x XmpText 8 > 0.746528 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:y XmpText 7 > 0.26196 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:w XmpText 8 > 0.255916 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:h XmpText 8 > 0.489198 > Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:unit XmpText > 10 normal > > And here is what Window want to see: > > Xmp.MP.RegionInfo XmpText 0 type="Struct" > Xmp.MP.RegionInfo/MPRI:Regions XmpText 0 type="Bag" > Xmp.MP.RegionInfo/MPRI:Regions[1] XmpText 0 type="Struct" > Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:Rectangle XmpText 38 0.438073, > 0.301923, 0.185780, 0.311538 > Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:PersonDisplayName XmpText 12 > Example Face > Xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:PersonEmailDigest XmpText 40 > E43A0343081CABFE3D1ED5C9F414B68E9F1D7EF8 > Xmp.MP.RegionInfo/MPRI:Regions[2] XmpText 0 type="Struct" > Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:Rectangle XmpText 38 0.126147, > 0.232692, 0.178899, 0.300000 > Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:PersonDisplayName XmpText 3 Bob > Xmp.MP.RegionInfo/MPRI:Regions[2]/MPReg:PersonEmailDigest XmpText 40 > F4F6C938D35ACA3A4B5EBFD68A2A4B207EB327EE > Xmp.xmpMM.InstanceID XmpText 41 > uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b > > Above all, I like the encrypted email :) Thanks for the clarification, I just wanted to check seeing as digikam reads face tags from windows live. Should I post a new feature request for writing windows live face tags? Created attachment 83037 [details]
Photo tagged with test program implementing Live Photo tagging
Here is a photo tagged with my test program, please tell me if Windows Live Photo can detect it and rectangle is positioned correctly on Artist's face :)
Created attachment 83040 [details]
Here's a screenshot of test photo in Windows Photo Gallery
It is detecting the tag correctly, but I think the rectangle is slightly off.
I've added a screenshot of where windows live displays it in case that is were it's supposed to be.
Created attachment 83046 [details]
Tagged photo
Please test this one :)
Created attachment 83047 [details]
No tags
Also, check this one without any tags :)
Hi Neither of those two show up as having people tags in windows photo gallery. Created attachment 83049 [details]
Jpeg tagged
Hmm... can it be because the file is .png?
Here, try a jpeg photo...
(In reply to comment #33) > Created attachment 83049 [details] > Jpeg tagged > > Hmm... can it be because the file is .png? > > Here, try a jpeg photo... Ok, I tried to add a tag to a png and check it with exiv2. Windows Photo Gallery doesn't appear to write any metadata to pngs. The new jpeg didn't work either however. Created attachment 83050 [details]
Jpeg tagged 2
Ok, so no png support,
I found some errors in first image's rectangle, here version 2
That one works great :) > @bug_id = 277429 > @bug_status = RESOLVED > @resolution = FIXED > @cf_commitlink = http://commits.kde.org/digikam/9d297b9d7a2c3c7eeb212ce3090a4349e930ed27 > > Git commit 9d297b9d7a2c3c7eeb212ce3090a4349e930ed27 by Veaceslav Munteanu. > Committed on 23/10/2013 at 13:20. > Pushed by munteanu into branch 'master'. > > M +28 -38 libs/dmetadata/dmetadata.cpp > M +0 -3 libs/dmetadata/dmetadata.h > > http://commits.kde.org/digikam/9d297b9d7a2c3c7eeb212ce3090a4349e930ed27 The Good: I pushed changes into git mater The Bad: digiKam's git is only for testing since it integrated GSoC projects and next stable version will be after at least half of year... (In reply to comment #35) > Created attachment 83050 [details] > Jpeg tagged 2 > > Ok, so no png support, > > I found some errors in first image's rectangle, here version 2 You can see the WIC (and by extension Windows [Live] Photo Gallery) doesn't support XMP outside of JPEG and TIFF (for PNG they only support tEXt): http://msdn.microsoft.com/en-us/library/windows/desktop/ee719653%28v=vs.85%29.aspx#metadataextensibility Seems to be a common problem. According to this forum, Photoshop and many Adobe products don't either (although the last comment indicates that it's planned for Photoshop in future): http://forums.adobe.com/thread/516779 I still think we write them out regardless since there are plenty of other apps that support it. And if someone has to use Adobe or some other app that doesn't when editing a photo, they can always use XMP sidecars. (In reply to comment #37) > The Good: I pushed changes into git mater > The Bad: digiKam's git is only for testing since it integrated GSoC projects > and next stable version will be after at least half of year... Hmm.. Since this change is small I'll roll it into 3.5.0 for Windows release (since it will probably only affect Windows users anyway). (In reply to comment #37) > > > @bug_id = 277429 > > @bug_status = RESOLVED > > @resolution = FIXED > > @cf_commitlink = http://commits.kde.org/digikam/9d297b9d7a2c3c7eeb212ce3090a4349e930ed27 > > > > Git commit 9d297b9d7a2c3c7eeb212ce3090a4349e930ed27 by Veaceslav Munteanu. > > Committed on 23/10/2013 at 13:20. > > Pushed by munteanu into branch 'master'. > > > > M +28 -38 libs/dmetadata/dmetadata.cpp > > M +0 -3 libs/dmetadata/dmetadata.h > > > > http://commits.kde.org/digikam/9d297b9d7a2c3c7eeb212ce3090a4349e930ed27 > > The Good: I pushed changes into git mater > The Bad: digiKam's git is only for testing since it integrated GSoC projects > and next stable version will be after at least half of year... Thank You. Shame about the release schedule, but at least it's in there now. Harry, We need a plan to release, else it's the hell to manage. Don't forget that digiKam is open source and people try to work on free time only. Look like Google Summer of code projects will be integrated in next major version 4.0.0, and it's a lots of work to validate new code and reduce side effect and regressions : http://community.kde.org/Digikam/GSoC2013#Roadmap_and_Releases_Plan_including_all_GSoC-2013_works Gilles Caulier (In reply to comment #41) > Harry, > > We need a plan to release, else it's the hell to manage. Don't forget that > digiKam is open source and people try to work on free time only. > > Look like Google Summer of code projects will be integrated in next major > version 4.0.0, and it's a lots of work to validate new code and reduce side > effect and regressions : > > http://community.kde.org/Digikam/ > GSoC2013#Roadmap_and_Releases_Plan_including_all_GSoC-2013_works > > Gilles Caulier Apologies, I didn't mean to sound like I was complaining about how long it would take, that's completely understandable. I was just saying it was unlucky that it just missed the latest release. Thanks, Harry |