Start of trail PGR Image Convert navigation bar

Table of Contents

PGR Find Object

Finds the center-of-mass coordinates (in pixels) of the object detected in the given image.

Library

QUARC Targets/Image Processing/Point Grey Research

Description

PGR Find Object

The PGR Find Object block searches a given image for objects (groups of pixels of a certain size) with the specified attributes. This block will search both color and grayscale images for up to five objects.

Input Ports

image

A matrix of type uint8 that represents a source image to be searched. The source image should be given in row major order. If the source image is color (RGB8 or BGR8), the source matrix should have three dimensions (eg., 3x640x480 for a color image of width 640 pixels and height 480 pixels). If the source image is a grayscale image, the source matrix should have two dimensions (eg., 640x480 for a grayscale image of width 640 pixels and height 480 pixels).

flag

A scalar that acts as an enabling signal to the block. When the flag input is 1, the block will search the source image for objects. Otherwise, the block will not search the source image and will retain the previous outputs. This signal is typically used to signal the block when a new source image is available in models where the image does not change at each sampling instant.

xest

A vector of type double containing up to five elements that correspond to x-axis (horizontal) coordinates for estimates of the objects. The length of the vector is exactly the number of objects specified in the Number of Objects parameter. This input is optional and if specified, the Find Object block can use the estimates to try to find the objects more efficiently. This input is only used when the yest input is also specified.

yest

A vector of type double containing up to five elements that correspond to y-axis (vertical) coordinates for estimates of the objects. The length of the vector is exactly the number of objects specified in the Number of Objects parameter. This input is optional and if specified, the PGR Find Object block can use the estimates to try to find the objects more efficiently. This input is only used when the xest input is also specified.

Output Ports

x

A vector of type double that contains the x-axis (horizontal) coordinates of the center-of-mass of any objects found with the specified attributes within the source image. The length of this vector is exactly the number of objects specified in the Number of Objects parameter.

y

A vector of type double that contains the y-axis (vertical) coordinates of the center-of-mass of any objects found with the specified attributes within the source image. The length of this vector is exactly the number of objects specified in the Number of Objects parameter.

pts

A matrix of type uint8 that contains a 2-dimensional black and white image with black pixels used to "mark" the pixels in the source image that fit the search attributes. The matrix is essentially a filtered version of the source image according to the block parameters. The matrix is given in column major order so that it can be displayed immediately using the Display Image block. This image is useful for seeing which parts of the source image are detected and for tuning the block parameters to achieve better results. Once the specified number of objects have been found, the block stops processing the source image and will not "mark" any more pixels.

n

A vector of type double that contains the number of pixels that constitute each found object. The length of this vector is exactly the number of objects specified in the Number of Objects parameter.

Parameters and Dialog Box

PGR Find Object

Detection Mode

This parameter tells the block to search for objects that are White, Black, or colored (RGB). If the detection mode is set to RGB, the R, G, and B parameters are enabled; otherwise they are disabled.

Pixel format

The format of the source image. The options for source image formats are: RGB8, BGR8, and Greyscale. RGB8 images use three unsigned bytes (integer values 0 to 255) to store the red (R), green (G), and blue (B) color information of each pixel in the specific order RGB. BGR8 images also use three unsigned bytes to store the R, G, and B color information of each pixel, but in the order BGR. Greyscale images use one byte to store the luminosity value of each pixel (0 representing black and 255 representing white).

Number of objects

A scalar integer from 1 to 5 that tells the block how many objects to find in the sourse image. After the block finds the specified number of objects in the source image it stops processing the image and outputs the corresponding coordinates of each object and the number of points constituting each object.

Threshold

A scalar value that can be used to tune the searching algorithm. When operating in black or white detection mode, the threshold allows the algorithm to "mark" any pixels that are within that range of values. For example, if the threshold is set to 50 and the block is set to White detection mode, the block will mark any pixels with luminosity values from 205 to 255 inclusive.

When RGB detection mode is selected, the algorithm will allow each R, G, and B pixel value to vary by the amount specified in the threshold parameter. For example, if the block is searching for pixels with (R,G,B) values (200, 100, 0) and the threshold is set to 10, the block will mark any pixels with (R,G,B) values that fall within R = 190 - 210, G = 90 - 110, B = 0 - 10 inclusive.

Minimum object size (pixels)

The minimum number of grouped pixels that constitute an object. If a group of pixels is found whose number is less than this minimum value it is not considered an object. This value can be used to filter out small artifacts in the source image which would otherwise be mistaken as detected objects.

R

The desired red value of pixels to search for. This parameter is disabled and ignored if the Detection Mode parameter is not set to RGB.

G

The desired green value of pixels to search for. This parameter is disabled and ignored if the Detection Mode parameter is not set to RGB.

B

The desired blue value of pixels to search for. This parameter is disabled and ignored if the Detection Mode parameter is not set to RGB.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time. A sample time of -1 indicates that the block inherits its sample time.

Warning This block is computationally intensive and may require slower sampling rates than the rest of the model to avoid delaying the model execution. Alternatively, the block could be placed in an asynchronous subsystem (see the Asynchronous Thread block).

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar