Operator SelectROI

The operator SelectROI extracts a rectangular region of interest (ROI) from the frames at the input link. The ROI is specified by using 4 parameters X_Offset, X_Length, Y_Offset and Y_Length. X parameters are to be specified in pixels. Y parameters are to be specified in lines.

If it is required to set the ROI coordinates using input links instead of parameters, operator DynamicROI must be used.

The operator will finalize the output image as soon as the ROI is completed. If the ROI is smaller than the input image this can result in a behavior that the output image is finalized earlier to the finalization of the input image. This is in contrast to operators RemoveLine or RemovePixel which have to wait for the last line / pixel.

Operator Restrictions

The sum of X_Offset and X_Length parameters must not exceed the maximal link image width. The sum of Y_Offset and Y_Length parameters must not exceed the maximal link image height.

Changing the dynamic ROI parameters is allowed when the process i.e. the acquisition is stopped only. Changes while the acquisition is running will have no effect on the ROI. This avoids invalid ROIs when the parameters are changed.

The lines of each input image must have the same length. Thus images with varying line lengths are not allowed.

  • In VisualApplets it is required that the number of pixels in a line i.e. the line width is always a multiple of the parallelism. When the X_Length is not divisible by the link parallelism the operator will insert dummy pixels to fill up the last parallel word, e.g. if the link parallelism is 2, X_Offset is 0 and X_Length is 5, the operator will output 6 pixel where the last pixel is a dummy pixel. The value of that dummy pixel is undefined. In VA simulation dummy pixels will be set to zero for better visibility.

  • When the input frame is smaller than the specified ROI the operator will output only the available part of the ROI.

  • When using the operator in 1D mode, the Y parameters have no effect on the operator. The operator will cut off ROIs only in X direction.

I/O Properties

Property Value
Operator Type P
Input Link I, data input
Output Link O, data output

Supported Link Format

Link Parameter Input Link I Output Link O
Bit Width [1, 64]1 as I
Arithmetic {unsigned, signed} as I
Parallelism any as I
Kernel Columns any as I
Kernel Rows any as I
Img Protocol {VALT_IMAGE2D, VALT_LINE1D} as I
Color Format any as I
Color Flavor any as I
Max. Img Width any as I
Max. Img Height any as I

1

The range of the input bit width is [1, 64]. For signed inputs, the range is [2, 64]. For unsigned color inputs, the range is [3, 63] and for signed color, the range is [6, 63].

Parameters

X_Offset
Type static/dynamic read/write parameter
Default 0
Range [0, MaxImgWidth - X_Length]

This parameter value (together with X_Offset) defines the position of the left edge of the ROI in pixels.

Y_Offset
Type static/dynamic read/write parameter
Default 0
Range [0, MaxImgHeight - Y_Length]

This parameter value (together with Y_Offset) defines the position of the upper edge of the ROI in pixels.

X_Length
Type static/dynamic read/write parameter
Default 1024
Range [1, MaxImgWidth - X_Offset]

This parameter defines the width of the ROI.

Y_Length
Type static/dynamic read/write parameter
Default 1024
Range [1, MaxImgHeight - Y_Offset]

This parameter defines the height of the ROI.

Examples of Use

The use of operator SelectROI is shown in the following examples:

  • 'ImageSplitAndMerge'

    Examples - Shows how to split an merge image streams. Appends a trailer to the image.