Bug 314509

Summary: Read face tags created by Picasa [patch]
Product: [Applications] digikam Reporter: Kristian Karl <kristian.hermann.karl>
Component: Faces-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: CLOSED FIXED    
Severity: normal CC: caulier.gilles, felix.leif, veaceslav.munteanu90
Priority: NOR    
Version: 3.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 3.3.0
Attachments: Read face tags made by Picasa

Description Kristian Karl 2013-02-06 12:40:13 UTC
A patch so that digikam can read face tags made by Picasa.

Reproducible: Always
Comment 1 Kristian Karl 2013-02-06 12:41:05 UTC
Created attachment 76942 [details]
Read face tags made by Picasa
Comment 2 Veaceslav Munteanu 2013-02-11 18:10:44 UTC
Hello, I'm trying to test your patch, but it seem that my build doesn't recognize any faces from Picassa tagged images. 

Maybe Picassa doesn't save tags, can you give me some samples that you used for testing?

Thanks,

Veaceslav
Comment 3 Kristian Karl 2013-02-12 09:02:20 UTC
Hi!
Are you sure that the image file has the tags? To make Picasa store face tags in image file, you have to enable that in Options. Please check the image with:
exiv2 -pa image.jpg

See also article: http://gcoupe.wordpress.com/2011/12/10/picasa-versus-windows-live-photo-gallery/   section "People Tags"


(In reply to comment #2)
> Hello, I'm trying to test your patch, but it seem that my build doesn't
> recognize any faces from Picassa tagged images. 
> 
> Maybe Picassa doesn't save tags, can you give me some samples that you used
> for testing?
> 
> Thanks,
> 
> Veaceslav
Comment 4 Veaceslav Munteanu 2013-02-12 15:30:38 UTC
Yes, I enabled that option and exiv2 show me:

Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]      XmpText     0  type="Struct"
Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Name XmpText     3  Dan
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.515046
Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:y XmpText     8  0.276427
Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:w XmpText     8  0.196245
Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:h XmpText     8  0.354552
Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:unit XmpText    10  normalized
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]      XmpText     0  type="Struct"
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Name XmpText     7  Claudia
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Type XmpText     4  Face
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area XmpText     0  type="Struct"
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:x XmpText     8  0.691358
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:y XmpText     8  0.260417
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:w XmpText     8  0.116255
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:h XmpText     8  0.209877
Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:unit XmpText    10  normalized

Where Dan and Claudia are tags name...

So far I forced digikam to scan for faces, read metadata from images, update database, but still no tags from pacassa images.

Also I surrounded you patch with debug statements and I saw that DMetadata::getImageFacesMap() is not called at all.
Comment 5 Kristian Karl 2013-02-12 15:38:02 UTC
Try to force Digikam to re-read metadata from image:
From main menu: Album -> Reread Metadata From Images
or, select the image, and from main menu: Image -> Reread Metadata From Image
That should do the trick!

(In reply to comment #4)
> Yes, I enabled that option and exiv2 show me:
> 
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]      XmpText     0  type="Struct"
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Name XmpText     3  Dan
> 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.515046
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:y XmpText     8 
> 0.276427
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:w XmpText     8 
> 0.196245
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:h XmpText     8 
> 0.354552
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[1]/mwg-rs:Area/stArea:unit XmpText   
> 10  normalized
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]      XmpText     0  type="Struct"
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Name XmpText     7  Claudia
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Type XmpText     4  Face
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area XmpText     0 
> type="Struct"
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:x XmpText     8 
> 0.691358
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:y XmpText     8 
> 0.260417
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:w XmpText     8 
> 0.116255
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:h XmpText     8 
> 0.209877
> Xmp.mwg-rs.Regions/mwg-rs:RegionList[2]/mwg-rs:Area/stArea:unit XmpText   
> 10  normalized
> 
> Where Dan and Claudia are tags name...
> 
> So far I forced digikam to scan for faces, read metadata from images, update
> database, but still no tags from pacassa images.
> 
> Also I surrounded you patch with debug statements and I saw that
> DMetadata::getImageFacesMap() is not called at all.
Comment 6 Veaceslav Munteanu 2013-02-12 16:19:36 UTC
Yes I did it multiple times, no tags so far. 

Now I'm trying to follow traces to see why getImageFacesMap() is not called.
Comment 7 Veaceslav Munteanu 2013-02-12 16:52:57 UTC
Ok.. Sorry it was my problem :D

Messed up cmake install prefix and also had digikam installed into multiple places...

Now everything works fine :)

I will notify Gilles.
Comment 8 Marcel Wiesweg 2013-02-12 18:17:23 UTC
Are you sure?
The metadata standard proposed by the Metadata Working Group is currently not implemented.
(we should, and replace our non-standard solution)
Comment 9 Veaceslav Munteanu 2013-02-12 18:24:31 UTC
Marcel, I've tested this patch with some photos tagged by Picassa and it works ok. Digikam is able to read them/store and display.

Should I commit this patch?
Comment 10 Veaceslav Munteanu 2013-02-13 11:42:32 UTC
Well, it seem that I let a bug to slip in.... :)

When I saw this bug: https://bugs.kde.org/show_bug.cgi?id=277429

and read Marcel's comment about image rotation and it's dependency upon the face tag rectangle, I decided to test face tagged by Picassa images.

After rotation, all tags are out of position, even Digikam native tags, but when you rotate back, tags are in position, except Picassa's tags. After rotation clockwise and back, you get extra tags. I had 2 tag in an image, know I have 4 tags, 2 of them are garbage.

Kristian, please take a look:
Steps to reporduce:
1. Rotate clockwise a Picassa tagged image
2. Rotate anticlockwise
3. Go to next image
4. Turn back to rotated image.
5. You should see more tags than usual.
Comment 11 Kristian Karl 2013-02-13 17:03:06 UTC
Veaceslav, I can confirm the bug.
Following your instructions, at step 5, I did indeed get more tags than [expected ]usual.
Comment 12 Veaceslav Munteanu 2013-02-13 22:10:35 UTC
Kristian, can you fix this? I already committed your patch, but with this bug it's not ok to leave it...
Comment 13 Kristian Karl 2013-02-14 09:52:13 UTC
Sure! Will do.

(In reply to comment #12)
> Kristian, can you fix this? I already committed your patch, but with this
> bug it's not ok to leave it...
Comment 14 Kristian Karl 2013-02-27 12:20:19 UTC
Hi Veaceslav,
After doing some investigation it looks like this is not a new bug. You'll get the same behavior if you use the attached example.jpg (https://bugs.kde.org/attachment.cgi?id=59036) from  bug 271030.
Also bug 277429 conatins interesing info, especially comment 16, with a link to https://git.reviewboard.kde.org/r/109087/ (I think it your stuff, right?) 

Anyways, the problem with duplicated, or additional face tags being added is that when the image is rotated, i re-reads the image and its metadata. So, we need to write metadata as you suggested in you last comment (in https://git.reviewboard.kde.org/r/109087/)
Comment 15 Veaceslav Munteanu 2013-05-23 20:48:27 UTC
Garbage tags fixed in picassafacetag that was merged into master:

http://quickgit.kde.org/?p=digikam.git&a=commit&h=0e69485123b1a4938e2c338a9c5142972b89bf82

Thank you, Kristian !