Utilize media metadata Date and Face-Tags in import and references

I am using media a lot and my fotos used in gramps already have metadata (EXIF/XMP/IPTC) for date, location, gps and facetags. When adding such media currenty date and reference to person and defining region (as substitue for facetag) have to be added manually. It would be of great advantage to me and probably others as well, if this information already available would be utilized by gramps. Before I write a feature request I would like to know your opinion on the topic of utilizing media meta-data.

I invision to utilize metadata(jpg,png) as follows:
a) EXIF-DATA: When adding media propose date taken from exif-date
b) When referencing media from a person use face-tag postion as ā€œreferenced regionā€. This avoids to draw manually each face which has been defined alread in the first place. Association between person and facetag-text could be done aquivalent to person-portrait. Facetag of first picture is associated with person.
c) Showing face-tags respective person-name in Image-data or new tab.
ā€¢ Even more comfort would be to offer all face-tags respective person-name as reference when adding media
ā€¢ Also helpful, but independend could be
ā—‹ to sort media in galleries according exif-date (or date entered.
ā—‹ Utilize gps-position (or textual location) to add to places

There is already an acknowledged Feature Request dealing with metadata, actually
Expand ImageMetadata gramplet to support XMP and IPTC metadata tags, but it does not cover ideas presented above. Besides comfort of such features it avoids to duplicate information which is prone for inconsistency which I hate.

Whatā€™s your though on that ?

BTW: Gramps is such a powerful tool , therefore I take the opportunity to thank all who have and still do contribute to gramps. And I am waiting eagerly for version 5.2!

2 Likes

I think what you are describing may already have a pull request (that is now out of date) and is discussed here: Suggested Update to PhotoTaggingGramplet to Support XMP Face Regions

I have created a Gist on Github code that updates the Photo Tagging Gramplet. This update displays existing regions in images and allows a user to associate a Gramps Person avoiding the need to redraw the region.

To try this code you need to replace the contents of PhotoTaggingGramplet.py with the contents of this Gist: Gramps - PhotoTaggingGramplet.py - Modified to display person regions embedded in photos Ā· GitHub

I have only tested this on a Windows computer. Please backup your data before using this.

I think you can try a first step at this feature here: Gramps Display XMP Metadata (Including Faces) in Metadata viewer Ā· GitHub Two files must be changed and I am very sure there are better ways to write this code. Both gramps\plugins\gramplet\metadataviewer.py and \gramps\plugins\lib\libmetadata.py need to be replace.

These changes show Named Regions in the photo in the Image Metadata Tag. This is for some reassurance for the user and to help with Photo Tagging.

I have only tested this on windows. Please backup your data before using this.

1 Like

Or, like in geography view, propose places near that position

I tried your enhanced version - it basically works fine! However, I do not understand how this frist step can be used ā€œfor some reassurance for the user and to help with Photo Taggingā€

It would be great to follow this up and enhance in order to propose references to all named persons. As described above, actually adding persons in the galeria for the person with a portrait (first foto) with this face-tag.

I know it is experimental, I found some problems:
1.) soemtimes faces are show only half height
grafik
2.) Sometimes face tags are missing at all - it seems to me this happens in case the face tag is at the edge of a foto (which actually happens with many of my portrait-fotos)

Anyway, thanks for taking the idea to a first step

Thanks for the feedback.

Would you be willing to send me one of these photos so that I can try and reproduce the issues and fix it?

This attempt to reassure that I didnā€™t delete any metadata in their image. Let me try and explain, this is because of issues I ran into in modifying the 2 gramplets. I have proposed changes to 2 gramplets:

  • Image Metadata (part of Gramps Core (outlined in blue)
  • Photo Tagging Gramplet (an addon) (outlined in red)

I had problems when modifying the Photo Tagging Gramplet that caused extra regions to appear. As a result, the Photo Tagging Gramplet only shows the XMP Regions if the photo has not been associated with a Person by manually drawing regions or added to a person gallery. I decided it would be good for the Image Metadata gramplet to show the region and face so that the user still knows the photo metadata is unaltered.

When you use the Photo Tagging gramplet and associate a person to the XMP Named Region, that portrait will appear in the personā€™s gallery in the last position.

I tried to modify the search box that appears when you select a person from the PhotoTagging gramplet. I wanted to pass the name in the photo metadata region and search for that value against the names in Gramps. I could not make it work. I donā€™t understand the Gramps Code well enough. There is a Filter option in the SelectPerson function that I think I need to use but I donā€™t see what I need to pass.

I hope this helps,
Bruce.

Thanks your follow up my remarks. I attach 3 fotos which have the behaviour described above:

  • Sometimes face tags are missing at all - it seems to me this happens in case the face tag is at the edge of a foto (which actually happens with many of my portrait-fotos
  • sometimes faces are show only half height

Ad face-tag not shown:


Artner, Josef
Wimmer, Anna

Actually portraits are extracted from marriage foto. Portrait foto of Wimmer Anna works well, however Portrait of Artner Josef does not show face tage in Metadata-View. face-tag region is identical wih left border of foto - I could track this behavior down several times to that cause.

Ad haf-sized face-tag
grafik
Actually when I start gramps face-tags of the marriage foto are shown correctly. Switching to another foto the effect appaear that only half is shown, also when switching back to fot which worked in the first time.

Hope this helps to track down reasons for this behaviour - and thanks again for following up these topics.

Thanks for the images. I didnā€™t see any face regions in the metadata and want to make sure nothing was stripped out by the Discourse software. Iā€™m going to send you a Direct Message with my email address. Could you email the photos to me and some of the examples where the region is at the edge of the photo.

I used ExifTool (https://exiftool.org/) to examine the metadata tags in the first file. The result showed there are no face regions embedded in the file.

PS C:\exiftool> exiftool -s -XMP-mwg-rs:all 'c:\exiftool\19081103-000000 Hochzeit Artner Josef und Anna - Pfarre Bruck an der Leitha.jpg'
PS C:\exiftool>

I expected to see a result similar to this example.

PS C:\exiftool> exiftool -s -XMP-mwg-rs:all 'F:\Families\J\Jackson__Edward_Stephen+Henders__Alicia\Jackson__Edward+Henders__Alicia-Maidstone-England-1922.jpg'
RegionName                      : Henders, Alicia Augusta, Jackson, Edward Stephan, Jackson, Henry Benjamin
RegionType                      : Face, Face, Face
RegionAreaX                     : 0.219668, 0.822836, 0.225464
RegionAreaY                     : 0.210395, 0.100658, 0.0743421
RegionAreaW                     : 0.0823029, 0.0915765, 0.0799845
RegionAreaH                     : 0.0655263, 0.0671053, 0.0623684
RegionAreaUnit                  : normalized, normalized, normalized

Letā€™s work through this offline and we will post a summary of what we learn to the community.

Bruce

Hi Bruce,

Hopefully this responce works since I could not find any private email-address.

It is quite likely forum software has stripped off something ā€“ sorry for confusion caused by this. See attached fotos and in addition the dropbox-link https://www.dropbox.com/sh/hbgqujvxogpkdvq/AAAbcDPq8-8kvz_z3D4cZDjxa?dl=0

Below what my exifgui shows

image001.png

image002.png

image003.png

Regards

Alfred

Artner, Josef.jpg

Wimmer, Anna.jpg

Perfect. The files in the dropbox link contain the regions.

I can reproduce the issue you are seeing with image thumbnails being half-height. I use a custom Theme with Gramps and I donā€™t have this issue. When I reset Gramps to the default theme, the full image thumbnail does not appear.

I can reproduce the problem with ā€˜Artner, Josef.jpgā€™ not showing all image metadata.

I will investigate and let you know what I find.

I have updated my code on github. These changes address the Face Region being past the edge of the image.

and

In testing for the issue of how the thumbnail is displayed:
image

I found that the Adwaita and High Contrast themes had problems displaying the full height of the thumbnail. The Raleigh theme seems to display properly. I installed a theme following these instructions: Windows AIO themes - Gramps I am using Gradient-Blue-318 and it seems to work okay.

Maybe someone who knows more about themes will read this and be able to offer some guidance.

Please let me know how the changes work.

3 Likes

Thanks for your updated Photo TaggingGramplet. Face region work fine not only for the example, but for a lot of face-tags which I browsed which previously failed.

Thumbnails are displayed now fully in my environment completely

Thanks again, the feature helps for manually assigning persons!
In the long run I hope someone will take care of automatism as proposed in this topic and other similar ideas posted in mantis
Alfred

1 Like

Hi:

It appears that the GIST hasnā€™t been modified in the last 2 years or so. Iā€™d like to explore face tagging but it would be nice to know if the code is still likely to work.

BTW, does anybody know if XMP face tagging is compatible between various bits of software. Some reading yesterday suggested that Lightroom, DigiKam, ACDSee, et al, may all have slightly different approaches? Is the PhotoTagging gramplet specific to one or work most or all XMP-tagged files?

Thanks,

Craig

@DavidMStraub has done some more recent work with it for GrampsWeb

A FaceBook posting suggested looking at the face_recognition repository Adam GeitgeyOwner avatar.

Not totally supported on windows.
Too many dependencies and this depend on opencv! (dlib):

Now letā€™s go through the steps to install Dlib. Follow our previous post Install OpenCV3 on Windows to complete Step 1, 2 and 3.

1 Like

canā€™t you just use OpenCV for Python?

The problem is opencv whose size is more than 150 MB.
This is why it is not included into gramps.

1 Like

But now, when there is a pip tool in Gramps, isnā€™t it possible to install it with that also for Windows users?

or maybe it would be nice to be able to use a native Python installation also on Windows for addonsā€¦ if it is possibleā€¦