vision.BlobAnalysis

Hblob = vision.BlobAnalysis returns a blob analysis object, H , used to compute statistics for connected regions in a binary image.

Hblob = vision.BlobAnalysis( Name,Value ) sets properties using one or more name-value pairs. Enclose each property name in quotes. For example, Hblob = vision.BlobAnalysis('AreaOutputPort',true)

Properties

Unless otherwise indicated, properties are nontunable , which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable , you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

AreaOutputPort — Return blob area
true (default) | false

Return blob area, specified as true or false .

CentroidOutputPort — Return coordinates of blob centroids
true (default) | false

Return coordinates of blob centroids, specified as true or false .

BoundingBoxOutputPort — Return coordinates of bounding boxes
true (default) | false

Return coordinates of bounding boxes, specified as true or false .

MajorAxisLengthOutputPort — Return vector whose values represent lengths of ellipses' major axes
false (default) | true

Return vector whose values represent lengths of ellipses' major axes, specified as true or false . Set this property to true to output a vector whose values represent the lengths of the major axes of the ellipses that have the same normalized second central moments as the labeled regions. This property applies when you set the OutputDataType property to double or single .

MinorAxisLengthOutputPort — Return vector whose values represent lengths of ellipses' minor axes
false (default) | true

Return vector whose values represent lengths of ellipses' minor axes, specified as true or false . Set this property to true to output a vector whose values represent the lengths of the minor axes of the ellipses that have the same normalized second central moments as the labeled regions. This property is available when the OutputDataType property is double or single .

OrientationOutputPort — Return vector whose values represent angles between ellipses' major axes and x-axis
false (default) | true

Return vector whose values represent angles between ellipses' major axes and x-axis, specified as true or false . Set this property to true to output a vector whose values represent the angles between the major axes of the ellipses and the x-axis. This property applies when you set the OutputDataType property to double or single .

EccentricityOutputPort — Return vector whose values represent ellipses' eccentricities
false (default) | true

Return vector whose values represent ellipses' eccentricities, specified as true or false . Set this property to true to output a vector whose values represent the eccentricities of the ellipses that have the same second moments as the region. This property applies when you set the OutputDataType property to double or single .

EquivalentDiameterSquaredOutputPort — Return vector whose values represent equivalent diameters squared
false (default) | true

Return vector whose values represent equivalent diameters squared, specified as true or false . Set this property to true to output a vector whose values represent the equivalent diameters squared.

ExtentOutputPort — Return vector whose values represent results of dividing blob areas by bounding box areas
false (default) | true

Return vector whose values represent results of dividing blob areas by bounding box areas, specified as true or false .

PerimeterOutputPort — Return vector whose values represent estimates of blob perimeter lengths
false (default) | true

Return vector whose values represent estimates of blob perimeter lengths, specified as true or false .

OutputDataType — Output data type of statistics
double (default) | single | Fixed point

Output data type of statistics, specified as double , single , or Fixed point . Area and bounding box outputs are always an int32 data type. Major axis length , Minor axis length , Orientation and Eccentricity do not apply when you set this property to Fixed point .

Connectivity — Connected pixels
8 (default) | 4

Connected pixels, specified as 4 or 8 .

LabelMatrixOutputPort — Maximum number of labeled regions in each input image
50 (default) | positive scalar integer.

Maximum number of labeled regions in each input image, specified as a positive scalar integer. The maximum number of blobs the object outputs depends on both the value of this property, and on the size of the input image. The number of blobs the object outputs may be limited by the input image size.

MinimumBlobArea — Minimum blob area in pixels
0 (default) | positive scalar integer.

Minimum blob area in pixels, specified as positive scalar integer.

Tunable: Yes

MaximumBlobArea — Maximum blob area in pixels
intmax('uint32') (default) | integer

Maximum blob area in pixels, specified as an integer.

Tunable: Yes

ExcludeBorderBlobs — Exclude blobs that contain at least one image border pixel
false (default) | true

Exclude blobs that contain at least one image border pixel, specified as true or false .

MaximumCount — Maximum number of labeled regions in each input image
50 (default) | positive scalar integer

Maximum number of labeled regions in each input image, specified as a positive scalar integer. The maximum number of blobs the object outputs depends on both the value of this property, and on the size of the input image. The number of blobs the object outputs may be limited by the input image size

Fixed-Point Properties

RoundingMethod — Rounding method for fixed-point operations
'Floor' (default) | 'Ceiling' | 'Convergent' | 'Nearest' 'Round' | 'Simplest' 'Zero'

Rounding method for fixed-point operations, specified as 'Floor' , 'Ceiling' , 'Convergent' , 'Nearest' , 'Round' , 'Simplest' , or 'Zero' .

OverflowAction — Action to take when integer input is out-of-range
'Wrap' (default) | 'Saturate'

Action to take when integer input is out-of-range, specified as 'Wrap' or 'Saturate' .

ProductDataType — Product data type
'Same as input' (default) | 'Custom'

Product data type, specified as 'Same as input' or 'Custom' .

CustomProductDataType — Product word and fraction lengths
numerictype(true,32,30) (default) | scaled numerictype object

Product word and fraction lengths, specified as a scaled numerictype (Fixed-Point Designer) object. This property applies only when you set the AccumulatorDataType property to 'Custom' .

AccumulatorDataType — Data type of accumulator
'Same as product' (default) | 'Same as input' | 'Custom'

Data type of accumulator, specified as 'Same as product' , 'Same as input' , or 'Custom' .

CustomAccumulatorDataType — Accumulator word and fraction lengths
numerictype(true,32,30) (default) | scaled numerictype object

Accumulator word and fraction lengths, specified as a scaled numerictype (Fixed-Point Designer) object. This property applies only when you set the AccumulatorDataType property to 'Custom' .

Usage

Syntax

Description

[ area , centroid , bbox ] = Hblob( bw ) returns the area, centroid, and the bounding box of the blobs when the AreaOutputPort , CentroidOutputPort and BoundingBoxOutputPort properties are set to true . These are the only properties that are set to true by default. If you set any additional properties to true , the corresponding outputs follow the area , centroid , and bbox outputs.

[ ___ , majoraxis ] = Hblob( bw ) computes the major axis length majoraxis of the blobs found in input binary image bw when you set the MajorAxisLengthOutputPort property to true .

[ ___ , minoraxis ] = Hblob( bw ) computes the minor axis length minoraxis of the blobs found in input binary image BW when you set the MinorAxisLengthOutputPort property to true .

[ bw ___ , orientation ] = Hblob( bw ) computes the orientation of the blobs found in input binary image bw when you set the OrientationOutputPort property to true .

[ ___ , eccentricity ] = Hblob( bw ) computes the eccentricity of the blobs found in input binary image bw when you set the EccentricityOutputPort property to true .

[ ___ , EQDIASQ ] = Hblob( bw ) computes the equivalent diameter squared EQDIASQ of the blobs found in input binary image bw when you set the EquivalentDiameterSquaredOutputPort property to true .

[ ___ , EXTENT ] = Hblob( bw ) computes the EXTENT of the blobs found in input binary image bw when the ExtentOutputPort property is set to true .

[ ___ , perimeter ] = Hblob( bw ) computes the perimeter of the blobs found in input binary image bw when you set the PerimeterOutputPort property to true .

[ ___ , label ] = Hblob( bw ) returns a label matrix label of the blobs found in input binary image bw when you set the LabelMatrixOutputPort property to true.