tdwg / ac

Audiovisual Core
http://www.tdwg.org/standards/638
Creative Commons Attribution 4.0 International
11 stars 6 forks source link

w3c FragmentSelector to AC terms? #259

Closed sharifX closed 10 months ago

sharifX commented 10 months ago

I am using "Selector" from the W3C annotation data model to capture regions of interest. (ref: https://www.w3.org/TR/annotation-model/#selectors). The use case: give a specimen image, more than one regions of interest or bounding boxes selected for annotation.

W3C example:

"selector": [
        {
          "type": "FragmentSelector",
          "value": "xywh=100,150,300,200",
          "conformsTo": "http://www.w3.org/TR/media-frags/"
        },
        {
          "type": "FragmentSelector",
          "value": "polygon=50,100 200,100 200,300 50,300",
          "conformsTo": "http://www.w3.org/TR/media-frags/"
        }

Could I map this to the AC namespace the following way?

"ac:hasROI": [
  {
    "ac:xFrac": 100,
    "ac:yFrac": 150,
    "ac:widthFrac": 300,
    "ac:heightFrac": 200,
  }
]

Not sure about the polygon.

baskaufs commented 10 months ago

Hi @sharifX You can't do it directly because the AC terms are described as relative positions (fractions) rather than as absolute pixels. There's an example of going from the AC ROI terms to W3C fragment selectors here. You are essentially doing the reverse process.

Currently, Audubon Core doesn't have terms to support polygons, although we talked about it when creating the existing terms. A polygon would definitely qualify as a way of defining a region of interest. The problem is that we chose to use relative positions in the methods we defined in order for the properties to apply to abstract image resources rather than particular ServiceAccessPoint (SAP) instances (particular files). You can see how this applies in the JSON serialization examples (see link above), which have multiple SAPs as well as multiple ROIs. So I think that polygons would be an important next step, but I think we'd want to see application and testing before defining terms. If you have thoughts on how that might be done, we'd love to hear them!