8 Replies Latest reply on Sep 26, 2016 9:22 AM by kuraman

    Export facial recognitions thumbnails?

    avit

      Hey guys,

       

      I would like to create a photo mosaic of people's faces at work. I have a huge lightroom library with loads of photos. I'd like to somehow export all the thumbnails which Lightroom creates of people's faces when you use it's inbuilt facial recognition feature.

       

      Any idea if that is possible? Can you use a third party plugin to do it?

       

       

      Best Regards

       

      AVIT

        • 1. Re: Export facial recognitions thumbnails?
          Tanuj Sandal Adobe Employee

          Hi avit,

           

          It is not possible to export the Facial Thumbnails of the faces, as Lightroom saves the names as a keyword in the Catalog.

           

          Regards,

          Tanuj

          1 person found this helpful
          • 2. Re: Export facial recognitions thumbnails?
            johnrellis Most Valuable Participant

            I don't know of a plugin that does this.  If you're technically minded, you could use the free Exiftool to extra the face rectangles and associated names. Then you could use the free ImageMagick tools to extract crops of those rectangles.  This wouldn't take programming, per se, but it would require familiarity with scripting command-line tools.

            • 3. Re: Export facial recognitions thumbnails?
              avit Level 1

              Many thanks! I will look into those tools!

              • 4. Re: Export facial recognitions thumbnails?
                kuraman Level 1

                If it helps I have written (badly) a python script that does exactly this. It doesn't handle rotated images (minor rotations will probably be ok). It writes out a .bat file that executes Imagemagick (to do the cropping) and Exiftool (to fix up the  keywords ). It is specific to my needs, but I am happy to provide it to anyone to tinker with (and improve?).

                 

                If there is interest I will put it on a server so it can be downloaded.

                 

                The script goes through all .xmp files in a nominated directory, and if one is found it looks for face regions. It generates a .bat file which uses Imagemagick to crop the original file.  The cropped images are placed in a faces subdirectory.  To use the script each image with faces must have its metadata written to an xmp file (CTRL-S), and the image exported as a .jpg (for Imagemagick) to the faces subdirectory- my images are all raw files so this export is needed to avoid trying to make Imagemagick incorporate any editting done in LR.

                 

                I am using "Python 2.7.12 on win32" - on Windows 10. I use some libraries (lxml) that I could only get to work on this combination.

                 

                The ideal solution would be for Adobe to have an "Export faces" checkbox in their export dialog. Until then this may help someone.

                • 5. Re: Export facial recognitions thumbnails?
                  ArmandoBruck Level 1

                  Hi.

                  You find the way to export or make a mosaic with the thumbnails from the People in LR cc?

                  Thank you

                  Armando

                  • 6. Re: Export facial recognitions thumbnails?
                    kuraman Level 1

                    Not exactly. Lightroom does not do the export of the faces. You must export the photos to a subdirectory, and ensure the metadata is "written to file". You then run a python script (which you will need to modify for your own situation). The script creates a batch file to run Imagemagick and exiftool, both of which you must have installed on your computer.  Although it is fairly straightforward this is only a solution for those with enough computer and coding skills to implement (including modifying the python script).

                     

                    The end result is a series of images in the subdirectory each of which is cropped from the face regions defined in the original images. The face name is embedded as a keyword.

                     

                    As this forum does not allow me to attach a file I will provide a link to the source code if anyone requests it.

                     

                    Ian

                    1 person found this helpful
                    • 7. Re: Export facial recognitions thumbnails?
                      ArmandoBruck Level 1

                      I do not have the skills to make te program work, I understood your solution, maybe Adobe work to give this tools.
                      Thank you.  

                      • 8. Re: Export facial recognitions thumbnails?
                        kuraman Level 1

                        Some further information for anyone thinking about using this.

                         

                        The most difficult part I found was finding a version of python under Windows 10  that would support the libraries I used, and installing these. (ie my script uses the python code  "from lxml import html, etree"). I suspect that the easiest way in the future would be to use the Linux Bash shell available under the Windows 10 anniversary update, but I haven't tested this. This way you can then use commands such as "sudo apt-get install python-lxml"  For more information see http://lxml.de/installation.html   This link also includes instructions for Mac users. There are detailed tutorials on the web describing how to get the Linux Bash shell under Windows 10 (it is not enabled by default).

                         

                        The modifications required in the python script are straightforward, and don't really require python coding skills. They are to change the directory name in which to find the exported files and to change the number of pixels in the x direction and y direction of your camera.  I have commented the script to show where these modifications need to be made.  It would be slightly more difficult to modify the script to get the number of pixels from the exif and this would be needed if you were using more than one camera for the files in the directory to be processed. The script does not handle arbitrarily rotated images. 90 degree rotations are OK. Minor rotations such as straightening horizons can be accommodated by making your face regions slightly larger. Implementing this feature (ie arbitrary rotations) requires reverse engineering how Adobe handles this - a more difficult task.

                         

                        My excuse for not making the python script more general is that it was for my own use and it meets my requirements as is.  I haven't yet spent the time to do this extra work . I use the "faces" feature to outline fins of dolphins for photo-ID and then output the individual "faces" to a dedicated catalog. I have a backlog of thousands of photos to process (ie to identify the dolphins) and will spend the time processing these (or taking more photos and increasing the backlog!).

                         

                        It would of course be infinitely preferable if Adobe were to add this feature to Lightroom. It seems a simple thing to do eg by adding a checkbox "Export faces" to the export dialog. Or perhaps someone is willing to develop an export plugin.

                         

                        Ian