Table of Contents
Image Find Objects
Finds objects within an image.
Library
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
qc_open_library('quarc_library/Image Processing/Generic')Description
The Image Find Objects block finds objects within an image. It is similar to the Blob Analysis block in the Computer Vision Toolbox, but may yield substantially better performance.
The Image Find Objects block currently supports only black and white (HxW) uint8 images. It assumes that the image has been preprocessed to isolate the colors of interest. It detects objects consisting of non-zero pixels in the image.
For each object found, the block outputs the bounding box, number of pixels in the object, and centroid of the object. The bounding boxes are output as a 4xN matrix, where N is the number of objects found. The number of pixels are output as an N-vector and the centroids are output as a 2xN matrix. Each bounding box is a 4-tuple ofo the form: (minimum row, minimum column, maximum row, maximum column). Each centroid is a 2-tuple of the form: (row, column).
The Image Find Objects block is optimized for finding large numbers of objects. It returns the objects according to the selected sort order. If the Find largest objects option is checked then it will find the N largest objects in the image, where N is the number of objects requested, and what constitutes the "largest" being determined by the sort criteria.
The Minimum number of pixels parameter allows noise to be ignored and improves performance. It is recommended that this parameter be set as large as possible without exceeding the minimum number of pixels in a desired object.
Input Ports
image
The input is a HxW uint8 image. Pixels to ignore should be black.
Output Ports
#
The number of objects actually found. This value indicates the number of valid columns in the other outputs.
area
The pixel area as a number of pixels for each object found. If the Use variable-sized output option is checked then the output is a variable-size uint32 N-vector, where N is the number of objects found. Otherwise it is a fixed-size vector whose length is equal to the Number of objects parameter.
ctr
The centroid of each object found. If the Use variable-sized output option is checked then the output is a variable-size 2xN single-precision floating-point matrix, where N is the number of objects found. Otherwise it is a fixed-size matrix where the number of columns is equal to the Number of objects parameter. Each centroid is a 2-tuple of the form: (row, column). Row and column indices are zero-based.
box
The bounding box of each object found. If the Use variable-sized output option is checked then the output is a variable-size 4xN uint16 matrix, where N is the number of objects found. Otherwise it is a fixed-size matrix where the number of columns is equal to the Number of objects parameter. Each bounding box is a 4-tuple of the form: (minimm row, minimum column, maximum row, maximum column). Row and column indices are zero-based.
ext
The extent of each object found. The extent is also known as the compactness, and is the ratio of the number of pixels in the object to the area of the bounding box. An extent of one indicates that the bounding box is completely filled by the object. If the Use variable-sized output option is checked then the output is a variable-size real32 N-vector, where N is the number of objects found. Otherwise it is a fixed-size vector where the number of columns is equal to the Number of objects parameter.
Parameters and Dialog Box
Number of objects
The number of objects to find.
Connectivity (tunable online)
The connectivity between pixels that deems pixels to belong to the same object. Connectivity in four directions means that pixels are considered "connected" if they are north (N), east (E), south (S) or west (W) of each other. Connectivity in eight directions means that pixels are considered "connected" if they are adjacent in any of the eight directions: N, NE, E, SE, S, SW, W or NW.
Sort order (tunable online)
The order in which to sort the objects at the output. This criteria is also used when the Find largest option is checked. The fastest performance is achieved if the objects are not sorted. The time required to sort the objects depends on the sort order chosen.
Minimum number of pixels (tunable online)
The minimum number of pixels that an object must contain to be considered a valid object. This parameter may be used to ignore noise in the image. Set it as large as possible without excluding desired objects for maximum performance.
Maximum number of pixels (tunable online)
The maximum number of pixels that an object must contain to be considered a valid object. This parameter may be used to ignore larger objects in the image. Set it as small as possible without excluding desired objects for maximum performance.
Find largest objects (tunable online)
This option causes the block to find the N largest objects out of the entire image, where N is the number of objects chosen in the Number of objects parameter. The size of an object is determined by the number of pixels in the object.
Exclude objects at edge (tunable online)
This option causes objects which touch the edge of the image to be excluded from the results. Since there is only partial information about objects which have been clipped at the edge of the image, objects at the edge of the image are often excluded.
Use variable-sized outputs
If this option is checked then all outputs but the # output will be variable-size signals, whose dimension varies with the number of objects actually found, up to the number of objects specified in the Number of objects parameter. If it is not checked, then the outputs will be fixed-size signals, whose dimension is determined by the Number of objects parameter.
Use complex output
If this option is checked then the centroid output, ctr, becomes a complex N-vector. The real component will be the row and the imaginary component the column. Otherwise the output will be a 2xN matrix.
Targets
Target Name |
Compatible* |
Model Referencing |
Comments |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
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 |
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.