Mat-oriented operations

These statements manipulate image matrices or stacks and create new media objects. They are listed here for users who think in terms of image operations rather than generic statements.

Page map

Complex image statements 5

CV.COMPLEX_CONJ

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Complex image statements   Namespace: CV

CV.COMPLEX_CONJ complexImage AS dst

Computes the complex conjugate of a complex image by negating the imaginary channel.

Minimal example

CV.COMPLEX_CONJ complexImage AS dst

CV.COMPLEX_MAGNITUDE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Complex image statements   Namespace: CV

CV.COMPLEX_MAGNITUDE complexImage AS magnitudeImage

Computes per-pixel magnitude sqrt(re^2 + im^2) from a complex image.

Minimal example

CV.COMPLEX_MAGNITUDE complexImage AS magnitudeImage

CV.COMPLEX_PHASE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Complex image statements   Namespace: CV

CV.COMPLEX_PHASE complexImage AS phaseImage

Computes per-pixel phase angle atan2(im,re), in radians, from a complex image.

Minimal example

CV.COMPLEX_PHASE complexImage AS phaseImage

CV.MERGE_COMPLEX

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Complex image statements   Namespace: CV

CV.MERGE_COMPLEX realImage, imagImage AS complexImage

Merges two same-size single-channel images into a CV_32FC2 complex image: channel 0 is real, channel 1 is imaginary.

Minimal example

CV.MERGE_COMPLEX re, im AS zimg

CV.SPLIT_COMPLEX

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Complex image statements   Namespace: CV

CV.SPLIT_COMPLEX complexImage AS realImage, imagImage

Splits a CV_32FC2/CV_64FC2 complex image into real and imaginary single-channel images.

Minimal example

CV.SPLIT_COMPLEX zimg AS re, im

Image creation / conversion statements 11

CV.CANVAS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.CANVAS width, height [, channels [, background]] AS dst

Creates a new 8-bit canvas image with 1 to 4 channels and a constant background value.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
channelsNumber of channels to create or process.
backgroundInitial canvas background value.

Minimal example

CV.CANVAS width, height [, channels [, background]] AS dst

CV.CHANNEL

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.CHANNEL src, index AS dst

Extracts one channel as a single-channel image or stack.

Minimal example

CV.CHANNEL src, index AS dst

CV.CLONE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.CLONE src AS dst

Duplicates the image or stack object.

Minimal example

CV.CLONE src AS dst

CV.COLOR

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.COLOR src, mode AS dst

Converts between common color spaces such as BGR, HSV, Lab, and gray.

Minimal example

CV.COLOR src, mode AS dst

CV.CONVERT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.CONVERT src, depth [, alpha [, beta]] AS dst

Converts OpenCV depth with optional scale and offset. Depth tokens include 8U, 16U, 32F, 64F and SAME.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
alphaMultiplicative scale factor.
betaAdditive offset after scaling.

Minimal example

CV.CONVERT img, "32F", 1.0 / 255.0 AS f

CV.GRAY

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.GRAY src AS dst

Converts to grayscale; on stacks it operates frame-by-frame.

Minimal example

CV.GRAY src AS dst

CV.INVERT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.INVERT src AS dst

Inverts pixel intensity; on stacks it operates frame-by-frame.

Minimal example

CV.INVERT src AS dst

CV.MERGE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.MERGE ch0, ch1 [, ch2 [, ch3]] AS dst

Merges one to four single-channel images/stacks into a multi-channel result.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
ch2Optional parameter. If omitted, the command uses its internal default.
ch3Optional parameter. If omitted, the command uses its internal default.

Minimal example

CV.MERGE ch0, ch1 [, ch2 [, ch3]] AS dst

CV.SCALE_ABS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.SCALE_ABS src [, alpha [, beta]] AS dst

Applies OpenCV convertScaleAbs, useful for visualizing gradients and signed/float maps.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
alphaMultiplicative scale factor.
betaAdditive offset after scaling.

Minimal example

CV.SCALE_ABS grad, 2.0 AS vis

CV.TO32F

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.TO32F src [, scale [, beta]] AS dst

Converts to 32-bit float using optional scale and offset.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
scaleMultiplicative scale factor; for geometric transforms it may mean image scale around the center.
betaAdditive offset after scaling.

Minimal example

CV.TO32F img, 1.0 / 255.0 AS f

CV.TO8U

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image creation / conversion statements   Namespace: CV

CV.TO8U src [, alpha [, beta]] AS dst

Converts to 8-bit unsigned using optional alpha and beta.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
alphaMultiplicative scale factor.
betaAdditive offset after scaling.

Minimal example

CV.TO8U f, 255.0 AS u8

Threshold and mask statements 12

CV.ADAPTIVE_THRESHOLD

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.ADAPTIVE_THRESHOLD src [, blockSize [, c]] AS dst

Applies an adaptive threshold frame-by-frame.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
blockSizeLocal analysis window size used by the algorithm.
cOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.ADAPTIVE_THRESHOLD src [, blockSize [, c]] AS dst

CV.CIRCLE_MASK

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.CIRCLE_MASK width, height, cx, cy, radius [, value] AS dst

Creates a single-channel circular mask.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.

Minimal example

CV.CIRCLE_MASK 80, 60, 40, 30, 12 AS mask

CV.COMPARE

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.COMPARE src, op, value AS dst

Creates a mask by comparing pixels with a scalar value. Operators: >, >=, <, <=, ==, !=.

Minimal example

CV.COMPARE img, ">", 128 AS mask

CV.FILL_HOLES

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.FILL_HOLES mask AS dst

Fills internal holes of a binary mask derived from non-zero pixels.

Minimal example

CV.FILL_HOLES mask AS filled

CV.INRANGE

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.INRANGE src, low, high AS dst

Segments pixels whose values fall inside a scalar range; the range is applied to all channels.

Minimal example

CV.INRANGE src, low, high AS dst

CV.INRANGE_COLOR

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.INRANGE_COLOR src, low0, low1, low2, high0, high1, high2 AS dst

Creates a 3-channel scalar range mask, useful after HSV/Lab conversion.

Minimal example

CV.COLOR img, "BGR2HSV" AS hsv
CV.INRANGE_COLOR hsv, 20, 60, 60, 40, 255, 255 AS mask

CV.KEEP_LARGEST

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.KEEP_LARGEST mask AS dst

Keeps only the largest connected foreground component of a binary mask.

Minimal example

CV.KEEP_LARGEST mask AS mainObj

CV.OTSU

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.OTSU src AS dst

Computes an automatic Otsu threshold on the grayscale source.

Minimal example

CV.OTSU src AS dst

CV.RECT_MASK

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.RECT_MASK width, height, x, y, w, h [, value] AS dst

Creates a single-channel rectangular mask. Legacy command equivalent to MASK.RECT with explicit coordinates.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.

Minimal example

CV.RECT_MASK 80, 60, 10, 12, 20, 15 AS mask

CV.THRESHOLD

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.THRESHOLD src, CV.THRESHOLD AS dst

Applies a fixed threshold frame-by-frame.

Minimal example

CV.THRESHOLD src, CV.THRESHOLD AS dst

CV.WATERSHED

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.WATERSHED src, markers AS labels[, colored]

Runs marker-based watershed. markers must have the same size as src and contain positive labels for seed regions; zero means unknown. labels is CV_32S; colored is an optional visualization.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
coloredOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.WATERSHED img, markers AS labels, colored
GUI.SHOW colored, "watershed"

CV.WATERSHED_AUTO

STATEMENTCVBATCH-FRIENDLYIMAGEMASK
Kind: Command   Category: Threshold and mask statements   Namespace: CV

CV.WATERSHED_AUTO src [, blurRadius [, distThreshold [, invert]]] AS labels[, colored]

Automatically builds watershed markers using Otsu thresholding, morphology, distance transform and connected components. distThreshold is typically 0.30..0.60; invert=TRUE is useful for dark objects on bright background.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
blurRadiusOptional parameter. If omitted, the command uses its internal default.
distThresholdOptional parameter. If omitted, the command uses its internal default.
invertOptional parameter. If omitted, the command uses its internal default.
coloredOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.WATERSHED_AUTO img, 1, 0.40 AS labels, colored
GUI.SHOW colored, "auto watershed"

Morphology statements 10

CV.BLACKHAT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.BLACKHAT src [, radius [, shape [, iterations]]] AS dst

Computes the black-hat transform frame-by-frame with selectable kernel shape.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
radiusKernel radius or neighborhood radius used by the filter.
shapeOptional parameter. If omitted, the command uses its internal default.
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.BLACKHAT gray, 4, RECT, 1 AS blackhatMap

CV.DILATE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.DILATE src [, radius [, shape [, iterations]]] AS dst

Applies morphological dilation frame-by-frame. shape can be ELLIPSE, RECT, or CROSS. The old numeric third parameter is still accepted as iterations.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
radiusKernel radius or neighborhood radius used by the filter.
shapeOptional parameter. If omitted, the command uses its internal default.
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.DILATE mask, 2, CROSS, 1 AS dilated

CV.DISTANCE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.DISTANCE src [, distanceType [, maskSize]] AS dst

Computes the distance transform of a binary mask derived from non-zero pixels.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
distanceTypeDistance-transform metric selector.
maskSizeDistance-transform mask size.

Minimal example

CV.DISTANCE src [, distanceType [, maskSize]] AS dst

CV.DISTANCE_TRANSFORM

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.DISTANCE_TRANSFORM mask [, distanceType [, maskSize [, normalize]]] AS dst

Computes a distance transform from a binary/non-zero mask. distanceType can be L1, L2 or C; maskSize can be 0, 3 or 5. normalize=TRUE scales the map to 0..255 as 32F.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
distanceTypeDistance-transform metric selector.
maskSizeDistance-transform mask size.
normalizeOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.DISTANCE_TRANSFORM mask, L2, 5, TRUE AS distMap

CV.ERODE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.ERODE src [, radius [, shape [, iterations]]] AS dst

Applies morphological erosion frame-by-frame. shape can be ELLIPSE, RECT, or CROSS. The old numeric third parameter is still accepted as iterations.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
radiusKernel radius or neighborhood radius used by the filter.
shapeOptional parameter. If omitted, the command uses its internal default.
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.ERODE mask, 2, RECT, 1 AS eroded

CV.MORPH_CLOSE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.MORPH_CLOSE src [, radius [, shape [, iterations]]] AS dst

Applies morphological closing frame-by-frame with selectable kernel shape.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
radiusKernel radius or neighborhood radius used by the filter.
shapeOptional parameter. If omitted, the command uses its internal default.
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.MORPH_CLOSE mask, 3, RECT, 1 AS closed

CV.MORPH_EX

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.MORPH_EX src, operation, kernelType, width, height [, iterations] AS dst

Applies a selectable morphological operation. operation: OPEN, CLOSE, GRADIENT, TOPHAT, BLACKHAT, ERODE, DILATE. kernelType: ELLIPSE, RECT, CROSS.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.MORPH_EX mask, CLOSE, RECT, 15, 5, 1 AS closedHorizontal

CV.MORPH_GRADIENT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.MORPH_GRADIENT src [, radius [, shape [, iterations]]] AS dst

Computes a morphological gradient frame-by-frame with selectable kernel shape.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
radiusKernel radius or neighborhood radius used by the filter.
shapeOptional parameter. If omitted, the command uses its internal default.
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.MORPH_GRADIENT mask, 2, CROSS, 1 AS grad

CV.MORPH_OPEN

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.MORPH_OPEN src [, radius [, shape [, iterations]]] AS dst

Applies morphological opening frame-by-frame with selectable kernel shape.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
radiusKernel radius or neighborhood radius used by the filter.
shapeOptional parameter. If omitted, the command uses its internal default.
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.MORPH_OPEN mask, 2, ELLIPSE, 1 AS opened

CV.TOPHAT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Morphology statements   Namespace: CV

CV.TOPHAT src [, radius [, shape [, iterations]]] AS dst

Computes the top-hat transform frame-by-frame with selectable kernel shape.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
radiusKernel radius or neighborhood radius used by the filter.
shapeOptional parameter. If omitted, the command uses its internal default.
iterationsNumber of repeated passes applied by the operation.

Minimal example

CV.TOPHAT gray, 4, ELLIPSE, 1 AS tophatMap

Image arithmetic statements 16

CV.ABSDIFF

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.ABSDIFF left, right AS dst

Computes the absolute difference between two images or stacks.

Minimal example

CV.ABSDIFF left, right AS dst

CV.ADD

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.ADD left, right AS dst

Adds two images or stacks. A single image can be broadcast across a stack.

Minimal example

CV.ADD left, right AS dst

CV.ADDS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.ADDS src, scalar AS dst

Adds a scalar value to every pixel.

Minimal example

CV.ADDS src, scalar AS dst

CV.BITAND

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.BITAND left, right AS dst

Computes the bitwise AND of two images or stacks. A single-channel mask can be broadcast to match a multi-channel image when size and depth already match.

Minimal example

CV.BITAND left, right AS dst

CV.BITNOT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.BITNOT src AS dst

Computes the bitwise NOT of the source image or stack.

Minimal example

CV.BITNOT src AS dst

CV.BITOR

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.BITOR left, right AS dst

Computes the bitwise OR of two images or stacks. A single-channel operand can be broadcast to match a multi-channel image when size and depth already match.

Minimal example

CV.BITOR left, right AS dst

CV.BITXOR

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.BITXOR left, right AS dst

Computes the bitwise XOR of two images or stacks. A single-channel operand can be broadcast to match a multi-channel image when size and depth already match.

Minimal example

CV.BITXOR left, right AS dst

CV.DIV

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.DIV left, right AS dst

Performs pixel-wise division between two images or stacks.

Minimal example

CV.DIV left, right AS dst

CV.DIVS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.DIVS src, scalar AS dst

Divides every pixel/channel of an image or stack by a non-zero scalar. This is clearer than CV.MULS src, 1/scalar.

Minimal example

CV.DIVS img, 2.0 AS half

CV.MAXIMUM

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.MAXIMUM left, right AS dst

Computes the per-pixel maximum of two images or stacks.

Minimal example

CV.MAXIMUM left, right AS dst

CV.MINIMUM

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.MINIMUM left, right AS dst

Computes the per-pixel minimum of two images or stacks.

Minimal example

CV.MINIMUM left, right AS dst

CV.MUL

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.MUL left, right AS dst

Performs pixel-wise multiplication between two images or stacks.

Minimal example

CV.MUL left, right AS dst

CV.MULS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.MULS src, scalar AS dst

Multiplies every pixel by a scalar value.

Minimal example

CV.MULS src, scalar AS dst

CV.NORMALIZE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.NORMALIZE src [, newMin [, newMax]] AS dst

Normalizes the source range into a target range using OpenCV NORM_MINMAX.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
newMinOutput minimum used by normalization.
newMaxOutput maximum used by normalization.

Minimal example

CV.NORMALIZE src [, newMin [, newMax]] AS dst

CV.SUB

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.SUB name([param1 [, param2 ...]])

Starts a named subroutine block. The block is skipped during normal flow and executed only by CALL.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
param1First algorithm-specific tuning parameter.
param2Second algorithm-specific tuning parameter.

Minimal example

CV.SUB

CV.SUBS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Image arithmetic statements   Namespace: CV

CV.SUBS src, scalar AS dst

Subtracts a scalar from every pixel/channel of an image or stack. This is clearer than CV.ADDS src, -scalar.

Minimal example

CV.SUBS img, 25 AS darker

Geometry / remap statements 14

CV.CROP

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.CROP src, x, y, w, h AS dst

Crops a ROI from the image or from all frames in the stack.

Minimal example

CV.CROP src, x, y, w, h AS dst

CV.CROP_RECT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.CROP_RECT src, rect AS dst

Crops a half-open RECT geometry from an image or from every frame in a stack. rect can be returned by RECT.CREATE, RECT.FROM_TEXT, RECT.CLIP, RECT.INTERSECT or ROI.RECT.

Minimal example

r = RECT.CREATE(10, 20, 30, 40)
CV.CROP_RECT img, r AS patch

CV.FLIP

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.FLIP src, mode AS dst

Flips an image or every stack frame. Modes: H/X horizontal, V/Y vertical, BOTH/XY both axes, or numeric OpenCV flipCode -1/0/1.

Minimal example

CV.FLIP img, "H" AS flipped

CV.PAD

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.PAD src, top, bottom, left, right [, value] AS dst

Adds a constant border around an image or every stack frame.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.

Minimal example

CV.PAD img, 10, 10, 20, 20, 0 AS padded

CV.PASTE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.PASTE base, patch, x, y AS dst

Pastes a patch image or patch stack into a base image/stack at x,y. Partial out-of-bounds pastes are clipped; single images broadcast across stacks.

Minimal example

CV.PASTE base, patch, 10, 20 AS out

CV.PASTE_RECT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.PASTE_RECT base, patch, rect AS dst

Pastes a patch into a destination RECT. The patch is resized to RECT.W/H when needed, then clipped to the base image bounds. Works frame-by-frame on compatible stacks.

Minimal example

r = RECT.CREATE(10, 20, 30, 40)
CV.PASTE_RECT base, patch, r AS out

CV.REMAP

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.REMAP src, flow AS dst OR CV.REMAP src, flowX, flowY AS dst

Warps an image or stack using optical-flow displacement maps. It accepts either a 2-channel FLOW map or separate flowX/flowY maps. When used with a stack and a sequential FARNEBACK flow stack that has one fewer frame, the first frame is copied unchanged and the remaining frames are remapped with the corresponding flow maps.

Minimal example

CV.REMAP src, flow AS dst  OR  CV.REMAP src, flowX, flowY AS dst

CV.RESIZE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.RESIZE src, w, h AS dst

Resizes the image or all frames in the stack.

Minimal example

CV.RESIZE src, w, h AS dst

CV.ROTATE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.ROTATE src, angle [, scale [, borderValue]] AS dst

Rotates around the image center using affine interpolation and a constant border value.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
scaleMultiplicative scale factor; for geometric transforms it may mean image scale around the center.
borderValueConstant value used to fill pixels outside the source image after a transform.

Minimal example

CV.ROTATE img, 12.5, 1.0, 0 AS rot

CV.ROTATE90

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.ROTATE90 src, code AS dst

Rotates by exact right angles without interpolation. Codes: 90/CW, 180, 270/CCW.

Minimal example

CV.ROTATE90 img, 90 AS rot

CV.TRANSLATE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.TRANSLATE src, dx, dy [, borderValue] AS dst

Translates image content by dx,dy pixels using a constant border value.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
borderValueConstant value used to fill pixels outside the source image after a transform.

Minimal example

CV.TRANSLATE img, 4, -2 AS shifted

CV.WARP_AFFINE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.WARP_AFFINE src, a00, a01, a02, a10, a11, a12 [, w [, h [, borderValue]]] AS dst

Applies a 2x3 affine transform matrix with optional output size and constant border value.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
wOptional output width, or ROI width when part of x,y,w,h.
hOptional output height, or ROI height when part of x,y,w,h.
borderValueConstant value used to fill pixels outside the source image after a transform.

Minimal example

CV.WARP_AFFINE img, 1, 0, 8, 0, 1, 4 AS shifted

CV.WARP_HOMOGRAPHY

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.WARP_HOMOGRAPHY src, H [, w [, h [, borderValue]]] AS dst

Applies a 3x3 homography stored in a ScriptArray. This is the array-based companion of CV.WARP_PERSPECTIVE and works frame-by-frame on stacks.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
wOptional output width, or ROI width when part of x,y,w,h.
hOptional output height, or ROI height when part of x,y,w,h.
borderValueConstant value used to fill pixels outside the source image after a transform.

Minimal example

CV.FIND_HOMOGRAPHY kpA, kpB, matches, 3.0 AS H, inliers
CV.WARP_HOMOGRAPHY imgB, H AS aligned

CV.WARP_PERSPECTIVE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Geometry / remap statements   Namespace: CV

CV.WARP_PERSPECTIVE src, a00, a01, a02, a10, a11, a12, a20, a21, a22 [, w [, h [, borderValue]]] AS dst

Applies a 3x3 homography/perspective transform matrix with optional output size and constant border value. On stacks it operates frame-by-frame.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
wOptional output width, or ROI width when part of x,y,w,h.
hOptional output height, or ROI height when part of x,y,w,h.
borderValueConstant value used to fill pixels outside the source image after a transform.

Minimal example

CV.WARP_PERSPECTIVE img, 1, 0.15, -18, 0.05, 1, -8, 0.0006, 0.0009, 1, 320, 240, 0 AS warped

Analysis / flow statements 33

CV.ADJUST_COLOR

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.ADJUST_COLOR src, brightness, contrastPercent, hueShift, saturationPercent AS dst

Applies brightness/contrast in BGR and hue/saturation in HSV; useful with GUI trackbars in live webcam demos.

Minimal example

CV.ADJUST_COLOR frame, brightness, contrast, hue, saturation AS tuned

CV.BG_SUBTRACT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.BG_SUBTRACT stack, method [, history [, varThreshold]] AS dst

Applies MOG2 or KNN background subtraction to a video/stack and returns an 8-bit foreground-mask stack. method can be "MOG2" or "KNN".

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
historyOptional parameter. If omitted, the command uses its internal default.
varThresholdOptional parameter. If omitted, the command uses its internal default.

Minimal example

IO.LOAD "input.avi" AS st
CV.BG_SUBTRACT st, "MOG2", 80, 16 AS fg

CV.CAMSHIFT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.CAMSHIFT src, roi [, hBins [, sBins [, maxIter [, epsilon]]]] AS rects[, preview]

Tracks the ROI color model with HSV backprojection and OpenCV CamShift, returning both the bounding rect and rotated box geometry in the N x 11 rects table. The optional preview draws rect and rotated box.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
hBinsOptional parameter. If omitted, the command uses its internal default.
sBinsOptional parameter. If omitted, the command uses its internal default.
maxIterOptional parameter. If omitted, the command uses its internal default.
epsilonOptional parameter. If omitted, the command uses its internal default.
previewOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.CAMSHIFT st, rect, 30, 32, 20, 1.0 AS rects, preview

CV.CANNY

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.CANNY src, low, high AS dst

Runs Canny edge detection frame-by-frame.

Minimal example

CV.CANNY src, low, high AS dst

CV.CONNECTED_COMPONENTS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.CONNECTED_COMPONENTS src [, connectivity] AS dst

Labels foreground connected components in a binary mask derived from non-zero pixels.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
connectivityConnected-component connectivity, normally 4 or 8.

Minimal example

CV.CONNECTED_COMPONENTS src [, connectivity] AS dst

CV.CONTOURS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.CONTOURS mask [, mode [, approx]] AS points, info

Extracts contours as numeric arrays. points columns: contourId, pointIndex, x, y. info columns: contourId, area, perimeter, x, y, w, h, pointCount. Modes: EXTERNAL, ALL/LIST, TREE, CCOMP. Approximation: SIMPLE or NONE.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
modeMode selector; accepted values are described in the command text.
approxOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.CONTOURS mask, EXTERNAL, SIMPLE AS contourPts, contourInfo
PRINT ARRAY.DIMSIZE(contourInfo, 0)

CV.CORNER_SUBPIX

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.CORNER_SUBPIX src, points [, winSize [, maxIter [, epsilon]]] AS refinedPoints

Refines an Nx2 or Nx>=2 point array with OpenCV cornerSubPix and returns a refined Nx2 array.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
winSizeOptical-flow averaging window size; larger values are smoother and less local.
maxIterOptional parameter. If omitted, the command uses its internal default.
epsilonOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.GOOD_FEATURES_POINTS img, 80, 0.01, 10 AS pts
CV.CORNER_SUBPIX img, pts, 5, 40, 0.001 AS refined

CV.DETECT_OBJECTS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.DETECT_OBJECTS src, cascadeFile [, scaleFactor [, minNeighbors [, minSizeW [, minSizeH]]]] AS rects[, preview]

Runs an OpenCV Haar/LBP cascade over an image or stack. rects columns: frameIndex, detectionIndex, x, y, w, h, score, classId. A sentinel row frameIndex=-1 means no detections. The optional preview draws rectangles.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
scaleFactorOptional parameter. If omitted, the command uses its internal default.
minNeighborsOptional parameter. If omitted, the command uses its internal default.
minSizeWOptional parameter. If omitted, the command uses its internal default.
minSizeHOptional parameter. If omitted, the command uses its internal default.
previewOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.DETECT_OBJECTS img, "haarcascade_frontalface_default.xml", 1.1, 4 AS faces, preview

CV.DRAW_FLOW_ARROWS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.DRAW_FLOW_ARROWS src, flow [, step [, scale [, minMag [, b [, g [, r [, thickness]]]]]]] AS dst

Draws optical-flow vectors as arrows over an image. The flow input must be generated by CV.FARNEBACK mode FLOW. Color uses OpenCV B,G,R order.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
stepOptional parameter. If omitted, the command uses its internal default.
scaleMultiplicative scale factor; for geometric transforms it may mean image scale around the center.
minMagOptional parameter. If omitted, the command uses its internal default.
bOptional parameter. If omitted, the command uses its internal default.
gOptional parameter. If omitted, the command uses its internal default.
rOptional parameter. If omitted, the command uses its internal default.
thicknessOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.DRAW_FLOW_ARROWS frame, flow, 24, 4.0, 0.6, 0, 255, 255, 1 AS arrows

CV.DRAW_MATCHES

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.DRAW_MATCHES img1, kp1, img2, kp2, desc1, desc2 [, maxDistance] AS dst

Matches ORB descriptors with a Hamming BFMatcher and draws the selected matches between two images. Kept for compatibility; use CV.MATCH_ORB + CV.DRAW_MATCHES_DATA when the match list must be reused.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
maxDistanceOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.DRAW_MATCHES imgA, kpA, imgB, kpB, descA, descB, 64 AS matchesPreview

CV.DRAW_MATCHES_DATA

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.DRAW_MATCHES_DATA img1, kp1, img2, kp2, matches [, maxDraw] AS dst

Draws matches from a numeric matches/inliers array, useful after CV.FIND_HOMOGRAPHY RANSAC filtering.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
maxDrawOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.DRAW_MATCHES_DATA imgA, kpA, imgB, kpB, inliers, 100 AS inlierPreview

CV.EDGES

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.EDGES src AS dst

Computes an edge map frame-by-frame.

Minimal example

CV.EDGES src AS dst

CV.FARNEBACK

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.FARNEBACK stack [, mode [, pyrScale [, levels [, winsize [, iterations [, polyN [, polySigma]]]]]]] AS dst OR CV.FARNEBACK prev, next [, mode [, pyrScale [, levels [, winsize [, iterations [, polyN [, polySigma]]]]]]] AS dst (robust defaults: pyrScale=0.5, levels=5, winsize=25, iterations=5, polyN=7, polySigma=1.5)

Computes dense Farneback optical flow either between consecutive frames of a stack or between two images/two stacks, returning raw flow, magnitude, angle, or a color visualization. Uses robust defaults and the Gaussian Farneback window for more stable video results.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
modeMode selector; accepted values are described in the command text.
pyrScaleFarneback pyramid scale between image levels.
levelsNumber of pyramid levels used by the optical-flow algorithm.
winsizeOptical-flow averaging window size; larger values are smoother and less local.
iterationsNumber of repeated passes applied by the operation.
polyNFarneback polynomial neighborhood size.
polySigmaFarneback Gaussian smoothing sigma for polynomial expansion.

Minimal example

CV.FARNEBACK stack [, mode [, pyrScale [, levels [, winsize [, iterations [, polyN [, polySigma]]]]]]] AS dst  OR  CV.FARNEBACK prev, next [, mode [, pyrScale [, levels [, winsize [, iterations [, polyN [, polySigma]]]]]]] AS dst  (robust defaults: pyrScale=0.5, levels=5, winsize=25, iterations=5, polyN=7, polySigma=1.5)

CV.FIND_HOMOGRAPHY

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.FIND_HOMOGRAPHY kp1, kp2, matches [, ransacThreshold] AS H, inliers

Estimates a 3x3 homography with RANSAC. H maps image-2/keypoints-2 coordinates onto image-1/keypoints-1 coordinates. inliers columns are queryIdx, trainIdx, distance, sourceMatchIndex.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
ransacThresholdOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.FIND_HOMOGRAPHY kpA, kpB, matches, 3.0 AS H, inliers

CV.FLOW_COLOR

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.FLOW_COLOR flow [, border] AS dst

Converts a 2-channel CV.FARNEBACK FLOW map to a BGR color visualization: hue is direction and brightness is motion magnitude.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
borderOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.FARNEBACK prevGray, gray, "FLOW" AS flow
CV.FLOW_COLOR flow AS flowColor

CV.GOOD_FEATURES

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.GOOD_FEATURES src [, maxCorners [, quality [, minDistance [, value]]]] AS dst

Draws Shi-Tomasi goodFeaturesToTrack points over an 8-bit BGR diagnostic image.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
maxCornersMaximum number of features/corners to keep.
qualityRelative quality threshold used by feature selection.
minDistanceMinimum distance between accepted features.
valueScalar value written, drawn, or used as foreground/background according to the command.

Minimal example

CV.GOOD_FEATURES img, 100, 0.01, 8 AS pts

CV.GOOD_FEATURES_POINTS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.GOOD_FEATURES_POINTS src [, maxCorners [, quality [, minDistance]]] AS points

Returns Shi-Tomasi corner coordinates as an Nx2 numeric array: x,y. This is the data-producing companion of CV.GOOD_FEATURES.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
maxCornersMaximum number of features/corners to keep.
qualityRelative quality threshold used by feature selection.
minDistanceMinimum distance between accepted features.

Minimal example

CV.GOOD_FEATURES_POINTS img, 100, 0.01, 10 AS pts

CV.HARRIS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.HARRIS src [, blockSize [, ksize [, k]]] AS dst

Computes a normalized Harris corner response map.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
blockSizeLocal analysis window size used by the algorithm.
ksizeDerivative/kernel aperture size.
kAlgorithm coefficient, for example the Harris detector free parameter.

Minimal example

CV.HARRIS img, 2, 3, 0.04 AS corners

CV.HIST_BACKPROJECT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.HIST_BACKPROJECT src, roi [, hBins [, sBins]] AS dst

Builds an HSV hue/saturation histogram from the ROI on the first frame, then returns a probability/backprojection map for the image or every frame of the stack.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
hBinsOptional parameter. If omitted, the command uses its internal default.
sBinsOptional parameter. If omitted, the command uses its internal default.

Minimal example

rect = RECT.CREATE(70, 60, 80, 80)
CV.HIST_BACKPROJECT img, rect, 30, 32 AS prob
GUI.SHOW prob, "backprojection"

CV.HOG_DETECT_PEOPLE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.HOG_DETECT_PEOPLE src [, hitThreshold [, scale [, finalThreshold]]] AS rects[, preview]

Runs OpenCV HOG people detection over an image or stack. rects columns: frameIndex, detectionIndex, x, y, w, h, score, classId. A sentinel row frameIndex=-1 means no detections. The optional preview draws rectangles.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
hitThresholdOptional parameter. If omitted, the command uses its internal default.
scaleMultiplicative scale factor; for geometric transforms it may mean image scale around the center.
finalThresholdOptional parameter. If omitted, the command uses its internal default.
previewOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.HOG_DETECT_PEOPLE frame, 0.0, 1.05, 2.0 AS people, preview

CV.HOUGH_CIRCLES

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.HOUGH_CIRCLES src [, dp [, minDist [, param1 [, param2 [, minRadius [, maxRadius [, value]]]]]]] AS dst

Detects circular structures with HoughCircles and draws the result over a diagnostic image.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
dpInverse accumulator resolution ratio used by HoughCircles.
minDistMinimum distance between detected circle centers.
param1First algorithm-specific tuning parameter.
param2Second algorithm-specific tuning parameter.
minRadiusMinimum circle radius to detect.
maxRadiusMaximum circle radius to detect; zero may let OpenCV choose automatically.
valueScalar value written, drawn, or used as foreground/background according to the command.

Minimal example

CV.HOUGH_CIRCLES img, 1.2, 20, 100, 30, 5, 80 AS circles

CV.HOUGH_LINES

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.HOUGH_LINES src [, rho [, thetaDeg [, threshold [, value]]]] AS dst

Detects Hough lines from a Canny edge map and draws them over a diagnostic image.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
rhoHough-line distance resolution in pixels.
thetaDegHough-line angular resolution in degrees.
thresholdDetection or segmentation threshold used by the command.
valueScalar value written, drawn, or used as foreground/background according to the command.

Minimal example

CV.HOUGH_LINES img, 1, 1, 50 AS lines

CV.KMEANS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.KMEANS src, k AS quantized

Quantizes an image or each frame of a stack with k-means clustering in channel space.

Minimal example

CV.KMEANS img, 4 AS quantized

CV.KMEANS_CENTERS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.KMEANS_CENTERS src, k AS centersArray

Returns the k-means centers of the first frame as a numeric K x channels array. Channel order follows OpenCV, so color images are B,G,R.

Minimal example

CV.KMEANS_CENTERS img, 4 AS centers

CV.LABELS_COLOR

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.LABELS_COLOR labels AS dst

Converts a label image, or a binary mask converted to connected components, into a deterministic color visualization.

Minimal example

CV.CONNECTED_COMPONENTS mask AS labels
CV.LABELS_COLOR labels AS colorLabels

CV.LAPLACIAN

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.LAPLACIAN src AS dst

Computes the Laplacian frame-by-frame.

Minimal example

CV.LAPLACIAN src AS dst

CV.MATCH_ORB

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.MATCH_ORB desc1, desc2 [, maxDistance [, maxMatches]] AS matches

Matches two ORB descriptor matrices with Hamming distance and cross-check. Output columns are queryIdx, trainIdx, distance, matchRank.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
maxDistanceOptional parameter. If omitted, the command uses its internal default.
maxMatchesOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.MATCH_ORB descA, descB, 64, 200 AS matches

CV.MATCH_TEMPLATE

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.MATCH_TEMPLATE src, templ [, method] AS dst

Computes an OpenCV template-matching response map. Source/template pairs may be broadcast across stacks.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
methodOpenCV method selector accepted by the command.

Minimal example

CV.MATCH_TEMPLATE src, templ [, method] AS dst

CV.MEANSHIFT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.MEANSHIFT src, roi [, hBins [, sBins [, maxIter [, epsilon]]]] AS rects[, preview]

Tracks the ROI color model with HSV backprojection and OpenCV meanShift. rects is an N x 11 table: frame,x,y,w,h,cx,cy,boxW,boxH,angle,score/iterations. The optional preview draws the tracked window.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
hBinsOptional parameter. If omitted, the command uses its internal default.
sBinsOptional parameter. If omitted, the command uses its internal default.
maxIterOptional parameter. If omitted, the command uses its internal default.
epsilonOptional parameter. If omitted, the command uses its internal default.
previewOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.MEANSHIFT st, rect, 30, 32, 20, 1.0 AS rects, preview

CV.ORB_DETECT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.ORB_DETECT src, nfeatures AS keypoints, descriptors

Detects ORB keypoints on the first frame. keypoints is an Nx7 array: x,y,size,angle,response,octave,class_id; descriptors is a CV_8U matrix.

Minimal example

CV.ORB_DETECT img, 800 AS kp, desc

CV.QR_DETECT

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.QR_DETECT src AS text

Detects and decodes the first QR code payload found in an image or stack. Returns an empty string if no QR code is decoded.

Minimal example

CV.QR_DETECT img AS qrText
IF qrText <> "" THEN
    PRINT "QR=" + qrText
ENDIF

CV.SCHARR

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.SCHARR src [, dx [, dy]] AS dst

Computes Scharr gradients. Without dx/dy it returns a combined gradient image.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
dxDerivative order or X displacement, depending on the command.
dyDerivative order or Y displacement, depending on the command.

Minimal example

CV.SCHARR img AS grad

CV.SOBEL

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Analysis / flow statements   Namespace: CV

CV.SOBEL src AS dst

Computes the Sobel gradient frame-by-frame.

Minimal example

CV.SOBEL src AS dst

Drawing statements 6

CV.DRAW_BBOX

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Drawing statements   Namespace: CV

CV.DRAW_BBOX src, mask [, value [, thickness]] AS dst

Draws the bounding box of the largest mask contour over the source image or stack.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.
thicknessOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.DRAW_BBOX img, mask, 255, 2 AS boxed

CV.DRAW_CONTOURS

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Drawing statements   Namespace: CV

CV.DRAW_CONTOURS src, mask [, value [, thickness]] AS dst

Draws external contours extracted from a binary mask over the source image or stack.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.
thicknessOptional parameter. If omitted, the command uses its internal default.

Minimal example

CV.DRAW_CONTOURS img, mask, 255, 1 AS overlay

DRAW.CIRCLE

STATEMENTDRAWBATCH-FRIENDLY
Kind: Command   Category: Drawing statements   Namespace: DRAW

DRAW.CIRCLE src, cx, cy, radius [, value [, thickness]] AS dst

Draws or fills a circle over an image or stack.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.
thicknessOptional parameter. If omitted, the command uses its internal default.

Minimal example

DRAW.CIRCLE src, cx, cy, radius [, value [, thickness]] AS dst

DRAW.LINE

STATEMENTDRAWBATCH-FRIENDLY
Kind: Command   Category: Drawing statements   Namespace: DRAW

DRAW.LINE src, x1, y1, x2, y2 [, value [, thickness]] AS dst

Draws a line over an image or over every frame of a stack and returns the modified media.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.
thicknessOptional parameter. If omitted, the command uses its internal default.

Minimal example

DRAW.LINE src, x1, y1, x2, y2 [, value [, thickness]] AS dst

DRAW.RECT

STATEMENTDRAWBATCH-FRIENDLY
Kind: Command   Category: Drawing statements   Namespace: DRAW

DRAW.RECT src, x, y, w, h [, value [, thickness]] AS dst

Draws or fills a rectangle over an image or stack.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.
thicknessOptional parameter. If omitted, the command uses its internal default.

Minimal example

DRAW.RECT src, x, y, w, h [, value [, thickness]] AS dst

DRAW.TEXT

STATEMENTDRAWBATCH-FRIENDLY
Kind: Command   Category: Drawing statements   Namespace: DRAW

DRAW.TEXT src, x, y, text [, value [, scale [, thickness]]] AS dst

Draws text using an OpenCV Hershey font over an image or stack.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
valueScalar value written, drawn, or used as foreground/background according to the command.
scaleMultiplicative scale factor; for geometric transforms it may mean image scale around the center.
thicknessOptional parameter. If omitted, the command uses its internal default.

Minimal example

DRAW.TEXT src, x, y, text [, value [, scale [, thickness]]] AS dst

Pixel access statements 3

CV.SET_PIXEL

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Pixel access statements   Namespace: CV

CV.SET_PIXEL src, x, y, value [, channel [, frame]] AS dst

Returns a copy where one pixel sample has been written. channel=-1 writes all channels; frame=-1 writes all frames.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
channelZero-based channel index; some commands accept -1 for grayscale/all channels.
frameZero-based frame index; some stack commands accept -1 for all frames.

Minimal example

CV.SET_PIXEL img, 10, 10, 255 AS marked
CV.SET_PIXEL img, 10, 10, 128, 1 AS greenOnly

CV.SET_PIXEL3

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Pixel access statements   Namespace: CV

CV.SET_PIXEL3 src, x, y, v0, v1, v2 [, frame] AS dst

Returns a copy where channels 0..2 of one pixel have been written. OpenCV color order is B,G,R.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
frameZero-based frame index; some stack commands accept -1 for all frames.

Minimal example

CV.SET_PIXEL3 colorImg, 20, 20, 0, 0, 255 AS redPixel

CV.SET_PIXEL4

STATEMENTCVBATCH-FRIENDLYIMAGE
Kind: Command   Category: Pixel access statements   Namespace: CV

CV.SET_PIXEL4 src, x, y, v0, v1, v2, v3 [, frame] AS dst

Returns a copy where channels 0..3 of one pixel have been written. OpenCV color order is B,G,R,A.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
frameZero-based frame index; some stack commands accept -1 for all frames.

Minimal example

CV.SET_PIXEL4 rgbaImg, 20, 20, 0, 0, 255, 255 AS redPixel

Static plot statements 3

PLOT.BAR

STATEMENTPLOTBATCH-FRIENDLY
Kind: Command   Category: Static plot statements   Namespace: PLOT

PLOT.BAR valuesText, width, height AS dst

Creates a bar-chart image from newline-separated numeric values.

Minimal example

PLOT.BAR valuesText, width, height AS dst

PLOT.XY

STATEMENTPLOTBATCH-FRIENDLY
Kind: Command   Category: Static plot statements   Namespace: PLOT

PLOT.XY pointsText, width, height AS dst

Creates a chart image from newline-separated X,Y numeric pairs.

Minimal example

PLOT.XY pointsText, width, height AS dst

PLOT.Y

STATEMENTPLOTBATCH-FRIENDLY
Kind: Command   Category: Static plot statements   Namespace: PLOT

PLOT.Y valuesText, width, height AS dst

Creates a chart image from newline-separated numeric Y values.

Minimal example

PLOT.Y valuesText, width, height AS dst

Other image / stack statements 5

CV.PALETTE

STATEMENTCVBATCH-FRIENDLYIMAGESTACK / VIDEO
Kind: Command   Category: Other image / stack statements   Namespace: CV

CV.PALETTE src, paletteFile AS dst OR CV.PALETTE var, paletteFile

Applies a .map RGB palette to a grayscale image/stack and returns a BGR color visualization. If paletteFile is not an absolute path, ./sys/palette is searched; the .map extension is optional.

Minimal example

img = CV.DESKTOP_IMAGE()
CV.PALETTE img, "thermal.map" AS colorImg
GUI.SHOW colorImg

CV.SHOW

STATEMENTCVBATCH-FRIENDLYIMAGESTACK / VIDEO
Kind: Command   Category: Other image / stack statements   Namespace: CV

CV.SHOW imageOrStack [, title]

Compatibility alias of SHOW.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
titleOptional GUI/DataPlot window title.

Minimal example

CV.SHOW

DEMO.HELLO

STATEMENTDEMOBATCH-FRIENDLYIMAGESTACK / VIDEO
Kind: Command   Category: Other image / stack statements   Namespace: DEMO

DEMO.HELLO [name]

Library: DemoStats user library 2.0.0 Prints a greeting from the DLL.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
nameOptional parameter. If omitted, the command uses its internal default.

Minimal example

DEMO.HELLO

DEMO.TYPES

STATEMENTDEMOBATCH-FRIENDLYIMAGESTACK / VIDEO
Kind: Command   Category: Other image / stack statements   Namespace: DEMO

DEMO.TYPES

Library: DemoStats user library 2.0.0 Prints the SDK data types supported by this demo library.

Minimal example

DEMO.TYPES

SERIAL.HELLO

STATEMENTSERIALBATCH-FRIENDLYIMAGESTACK / VIDEO
Kind: Command   Category: Other image / stack statements   Namespace: SERIAL

SERIAL.HELLO [name]

Library: Serial user library 1.0.0 Prints a greeting from the DLL.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
nameOptional parameter. If omitted, the command uses its internal default.

Minimal example

SERIAL.HELLO