0

I cannot get hold of the XMP standard at the moment, all linked pages seem to be down. I would like to know how it defines the region of interest, e.g. to mark a face. As far as I remember, I should specify the centre of RoI and its width and height, with relative coordinates. But which corners do (0, 0) and (1, 1) correspond to?

2

The XMP files created by Lightroom seems to follow the MWG description (website currently down), as it contains this link to describe its content :

xmlns:mwg-rs="http://www.metadataworkinggroup.com/schemas/regions/"

I took a random XMP file from one of my picture containing a recognized person : the part mwg-rs:Region is structured as follows :

<mwg-rs:Regions rdf:parseType="Resource">
    <mwg-rs:AppliedToDimensions
     stDim:w="4731"
     stDim:h="3154"
     stDim:unit="pixel"/>
    <mwg-rs:RegionList>
     <rdf:Bag>
      <rdf:li>
       <rdf:Description
        mwg-rs:Rotation="-0.15987"
        mwg-rs:Name="The name part"
        mwg-rs:Type="Face">
       <mwg-rs:Area
        stArea:h="0.17613"
        stArea:w="0.11730"
        stArea:x="0.42527"
        stArea:y="0.35826"/>
       </rdf:Description>
      </rdf:li>
     </rdf:Bag>
    </mwg-rs:RegionList>
</mwg-rs:Regions>

You can see that for this image, the region is specified by an "Area" structure, containing 4 values, which appear to be percentages relative to the whole image :

  • stArea:x and stArea:y are the coordinates of the center of the area, relative to the upper left corner of the image
  • stArea:h and stArea:w are the height and the width

So to answer your question, (0,0) is the upper left corner of the pictures and (1,1) is the lower right corner.

As a side note, I don't know how the "Rotation" parameter of the mwg-rs Description part comes to play: at your place, I would make some tests :)

  • Thanks for answering about the coordinate system. However: are you sure stArea:x, y refer to the corner of the area? I would expect (and also vaguely remember) that it's the centre. – texnic Apr 9 at 12:36
  • I found my own old question where the exampl shows that (x, y) probably define the centre of the region (x+w and y+h are both >1). – texnic Apr 9 at 12:39
  • You are right regarding the area:x and area:y parameters, I edited my answer. – Olivier Apr 9 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.