Skip to main content

UpdateBoundingBox

Updates existing BoundingBox objects that satisfy the specified constraints.

Parameters​

ref and constraints are optional and are intersected when both are present. Scope warning: omitting all selectors targets every BoundingBox object. Always supply selectors for a scoped mutation.

Parameter

JSON type

Behavior

constraints

array expression

Optional. No property filter; the command-specific selector requirement still applies. Filters existing objects using the constraints expression language. When ref is supplied it filters that referenced set.

label

string

Optional. When omitted, the existing label is unchanged. Sets the object’s label independently of user properties.

properties

object mapping property names to values

Optional. When omitted, existing user properties are unchanged except for keys listed in remove_props. Stores booleans, numbers, strings, supported arrays, or single-key _date, _blob, and _json wrappers. Bare null is rejected; property names and wrapped values are validated. See the properties reference for nested value rules. Replaces supplied property values without replacing the whole property map.

rectangle

object with integer x, y, width, height

Optional. Existing rectangle is unchanged. All four fields are required when rectangle is present. x and y are nonnegative; width and height are positive; each is at most 2147483647. Replaces the entire rectangle. Insertion does not validate it against image dimensions.

ref

integer, 1 through 100000

Optional. Select using the other supplied selectors; see the selection rule above. Uses an earlier compatible BoundingBox reference in this transaction; forward references, wrong types, and undeclared references are rejected.

remove_props

array of strings

Optional. When omitted, no properties are removed. Removes named properties from selected objects; missing keys have no effect. A value also supplied in properties is stored after removal.

Details​

If the ref parameter is used, constraints will act as additional filters on the referenced result set.

If the ref parameter is specified, it must refer to the results of an earlier AddBoundingBox or FindBoundingBox within the transaction.

If the rectangle parameter is present, the bounding boxes coordinates will be updated.

If the label parameter is present, the bounding boxes labels will be updated.

For more complex searches for objects to update, a Find command must be used first within the transaction.

Response and errors​

An authenticated session with the objects update permission is required.

The response is an object under UpdateBoundingBox with integer status and, on success, integer count. Status 0 means the mutation completed; count is the number of selected objects affected, including zero when none match. No output blobs are returned.

Invalid field types, missing required fields, malformed expressions, and invalid references fail validation. Execution failures include a nonzero status and an info message; inspect the transaction response before assuming a mutation succeeded.

Examples​

Find the bounding boxes with the “year_captured” property equal to 2007, and updating the label and the rectangle coordinates:

[{
"UpdateBoundingBox": {
"constraints": ["$year_captured", "==", 2007],
"remove_props": ["type"],
"label": "Dog",
"rectangle": {
"x": 100,
"y": 100,
"width": 50,
"height": 50
}
}
}]

Successful response:

[{
"UpdateBoundingBox": {
"count": 1,
"status": 0
}
}]

Find the bounding boxes connected to the image with “unique_id” = 34, and that are inside a given rectangle, and update the label to “People”, and remove the “label_type” property:

[{
"FindImage": {
"_ref": 1,
"constraints": ["$unique_id", "==", 34],
"blobs": true
}
}, {
"FindBoundingBox": {
"_ref": 2,
"image_ref": 1,
"blobs": false,
"coordinates": true,
"labels": true,
"in_rectangle": {
"x": 100,
"y": 0,
"width": 500,
"height": 500
}
}
}, {
"UpdateBoundingBox": {
"ref": 2,
"label": "People",
"remove_props": ["label_type"]
}
}]

Successful response:

[{
"FindImage": {
"blobs_start": 0,
"returned": 1,
"status": 0
}
}, {
"FindBoundingBox": {
"entities": [{
"_coordinates": {
"height": 40,
"width": 40,
"x": 120,
"y": 50
},
"_label": "Dog"
}],
"returned": 1,
"status": 0
}
}, {
"UpdateBoundingBox": {
"count": 1,
"status": 0
}
}]