UpdateImage
Updates existing Image objects that satisfy the specified constraints.
Parameters
[optional] ref: Reference to other entities within the transaction.
[optional] constraints
[optional] properties
[optional] remove_props
[optional] operations
Details
If the ref parameter is used, constraints will be ignored.
If the ref parameter is specified, it must refer to the search result of a previous FindImage.
If the operations parameter is specified, the images will be transformed accordingly unless these are remote images. Remote images are not updated and the query returns with an error. NOTE: bounding boxes, if any, would remain unchanged.
For more complex searches for object to delete, a Find command must be used first within the transaction.
Examples
Find the images with the “year_captured” property equal to 2007, and remove the “focal_length” property:
[ {
"UpdateImage": {
"constraints": {
"year_captured": [ "==", 2007 ],
},
"remove_props": [ "focal_length" ]
}
}]
Find an image with the “year_captured” property equal to 2007, verify that only one image satisfy the constraint, update the “focal_length_mm” property and resize them to 224x224:
[ {
"UpdateImage": {
"unique": true,
"constraints": {
"year_captured": [ "==", 2007 ],
},
"properties": {
"focal_length_mm": 55
},
"operations": [
{
"type": "resize",
"width": 224,
"height": 224
}
]
}
}]
Resize to 224x224 all the images that are connected to an entity of the class “Dataset” and with a property “name” equal to “COCO”:
[ {
"FindEntity": {
"class": "Dataset",
"_ref": 1,
"constraints": {
"name": ["==", "COCO"]
}
}
}, {
"FindImage": {
"_ref": 2,
"is_connected_to": {
"ref": 1,
"class": "in_dataset"
},
"blobs": false
}
}, {
"UpdateImage": {
"ref": 2,
"operations": [
{
"type": "resize",
"width": 224,
"height": 224
}
]
}
}]