AddBoundingBox

Add a new bounding box and properties associated with it.

Parameters

  • [optional] _ref: Reference to be used within the transaction.
  • [optional] image: Reference to an image within the transaction (either the result of a FindImage or an AddImage), which will be used to create a connection to.

Blocks

Details

The image is reference to a single Image object that will be connected to the created bounding box automatically. If the reference points to multiple Image object, an error is returned. While it is not required, it is highly recommended that the connection between Image and BoundingBox objects are created this way.

A rectangle block is required, as it indicates the boundaries of the bounding box.

Examples

Insert an Image and 2 BoundingBox objects, and create a connection between the 2 BoundingBox objects and the Image:

[ {
    "AddImage" : {
        "_ref" : 1,
        "format" : "png",
        "properties" : {
            "description" : "dog playing in a park"
        }
    }
},{
    "AddBoundingBox" : {
        "image": 1,
        "rectangle" : {
            "x": 120,
            "y": 50,
            "w": 40,
            "h": 40
        },
        "properties": {
            "label":    "Dog",
            "label_id": 32
        }
    }
},{
    "AddBoundingBox" : {
        "image": 1,
        "rectangle" : {
            "x": 10,
            "y": 20,
            "w": 400,
            "h": 400
        },
        "properties": {
            "label":    "park",
            "label_id": 6
        }
    }
} ]

Insert an Image and a BoundingBox, and create a connection between the 2 objects, and connect the BoundingBox to an existing Entity of the class “Person” with a specific “unique_id” property:

[ {
    "FindEntity" : {
        "_ref" : 1,
        "unique" : true,
        "constraints" : {
            "unique_id": ["==", 2341]
        }
    }
},{
    "AddImage" : {
        "_ref" : 2,
        "format" : "png",
        "properties" : {
            "description" : "dog playing in a park"
        }
    }
},{
    "AddBoundingBox" : {
        "image": 2,
        "rectangle" : {
            "x": 120,
            "y": 50,
            "w": 40,
            "h": 40
        },
        "properties": {
            "label":    "Dog",
            "label_id": 32
        },
        "link": {
            "ref": 1,
            "class": "PersonInImage"
        }
    }
} ]