Skip to content

LJSON landmark file specification

James Booth edited this page Oct 19, 2015 · 3 revisions

Landmarks are loaded and saved as .ljson files, as understood by the menpo python library. The current version of the format is v2.

You can see an example in the demo data for the landmarker (https://github.com/menpo/landmarker.io/blob/master/api/v2/landmarks/james/ibug68.json).

Though a template is used to generate empty landmark files, the json file contains all the information necessary including the point groups and their labels.

Fields

The file contains a json object containing the following fields:

  • landmarks (object)
    • points (array) - the ordered locations of each points on the resource (2d or 3d as long as it consistent). Similar to the list of points in a pts file.
    • connectivity: (array) - list of tuples [a, b] where a and b are valid indices for 2 points which should appear connected.
  • labels (array of objects) - the label field is the name of the group, while the mask field is a list of the indices for the points which belong to this group, they do not need to be contiguous.
  • version (integer) - for validation.

JSON Schema

Here's a minimal json schema you can use to validate your files (see http://json-schema-validator.herokuapp.com/):

{
  "type": "object",
  "properties": {
    "landmarks": {
      "id": "landmarks",
      "type": "object",
      "properties": {
        "points": {
          "id": "points",
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "number"
            }
          }
        },
        "connectivity": {
          "id": "connectivity",
          "type": "array",
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "type": "integer"
            }
          }
        }
      }
    },
    "labels": {
      "id": "labels",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "id": "label",
            "type": "string"
          },
          "mask": {
            "id": "mask",
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      }
    },
    "version": {
      "id": "version",
      "type": "integer"
    }
  }
}