Skip to main content

Capture

The controller exposes its own sendCapture() that works at the raw image and element level — different from Visu.page0.display1.sendCapture() which takes a Capture MES object.

sendCapture()

Atomically replaces the current image and all elements in a single update.

sendCapture(image: Ve.Image, ve: Record<string, Ve.VisionElement[]>): Promise<void>;

The ve parameter is a dictionary where each key becomes a group name in the Objects Tree, and the value is the list of elements in that group. An empty string key "" is treated the same as no key — both map to the default group.

This method is atomic: the client replaces image and elements in a single React render, so there is no visible intermediate state where the new image shows with the old elements or vice versa.

var ctrl = Visu.page0.display1.getController();
var image = Cameras.camera1.getImage();
var rects = ...; // Ve.VisionElement[]

await ctrl.sendCapture(image, {
"Detections": rects,
"ROI": [roiRect],
});
When to use this vs setImage + addElements

Use sendCapture() when you want to fully replace the scene on every cycle — it is the most efficient path because it cancels any pending partial updates and sends everything in a single packet.

Use setImage() + addElements() / refreshElement() when you need to update the image and elements independently — for example, updating only a subset of elements while keeping the image unchanged.