Main Menu

How to get face cordinate

Started by shrestha, December 19, 2013, 07:24:49 AM

Previous topic - Next topic

shrestha

Hi All,
I have just used ExifTool from yesterday and found that it is quite nice to use with perl.
I have tagged some images with picasa and now would like to extract the tag-name with their co-ordinates (face coordinates). I saw the output from ExifTools and it gives all the names on images and also X,Y,W,H but if I am not wrong this is not the rectangle region of the face/s.
Is there any script or method to extract the face coordinate for each faces in images.

Thanks in advance,

Shrestha

Phil Harvey

Hi Shrestha,

There are different methods for storing face positions and I'm not sure which one Picasa uses.  ExifTool just extracts what is written.  If you want to do any manipulations of the extracted values, you can create a user-defined Composite tag for this.  This may not help, but the full ExifTool distribution contains config_files/convert_regions.config which defines Composite tags to convert between the two common region structures.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

shrestha

Dear Phil
While using ExifTool, I found that it has face name tag and also some co-ordinates values. Here is small segment:

ExifByteOrder                   : Little-endian (Intel, II)
Software                        : Picasa
ModifyDate                      : 2013:12:17 16:19:14
ExifVersion                     : 0220
ExifImageWidth                  : 960
ExifImageHeight                 : 640
XMPToolkit                      : XMP Core 5.1.2
RegionAppliedToDimensionsW      : 960
RegionAppliedToDimensionsH      : 640
RegionAppliedToDimensionsUnit   : pixel
RegionName                      : sagar, hari, ananta dd, pema, dhanu
RegionType                      : Face, Face, Face, Face, Face
RegionAreaX                     : 0.547917, 0.634375, 0.266667, 0.365104, 0.6375

RegionAreaY                     : 0.458594, 0.472656, 0.629688, 0.441406, 0.6710
94
RegionAreaW                     : 0.08125, 0.0791667, 0.0895833, 0.0510417, 0.09
16667
RegionAreaH                     : 0.145312, 0.142187, 0.1625, 0.0890625, 0.16406
3
RegionAreaUnit                  : normalized, normalized, normalized, normalized
, normalized
ProfileCMMType                  : lcms
ProfileVersion                  : 2.1.0
ProfileClass                    : Display Device Profile
ColorSpaceData                  : RGB

Here, when I try to manipulate the values RegionAreaX, RegionAreaY, it seems it is center of face rather than co-ordinate of face rectangle. What does RegionAreaW, RegionAreaH stand for? Are they also normalized with height and width??
How can I extract RegionAreaX, RegionAreaY, RegionAreaW, RegionAreaH from perl and converts into rectangle face. (if my assumption is true that this gives the face rectangle.)

Thanks for quick response.
Shrestha

Phil Harvey

These region tags are explained in the MWG documentation.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).