# Analyze blob geometry

Calculates geometric properties for labeled objects. All measurements are made in world coordinates.

## Inputs

labels
A labeled image. Each connected blob in the output image is marked with a distinct numeric label. Pixels that belong to the first detected blob are ones, the pixels that belong to the second one with twos and so on. Background is zero.
aligned
If this flag is true, the size, upperLeft, upperRight, lowerLeft, lowerRight and frame output parameters are calculated after aligning the bounding box of a blob according its major axis. Otherwise, the measurements are made from a bounding box that is aligned to the x and y axes of the world coordinate system.
preferredAngle
If aligned measurements are enabled, this parameter determines the preferred direction of the blob's aligned x axis in the world coordinate system, in degrees. For example, if the blob is approximately horizontally aligned, setting preferredAngle to 0 would ensure its frame would be attached to the upper left corner. Setting preferredAngle to 180 would attach the frame to the lower right corner and turn the coordinate system upside down.

## Outputs

area
The number of pixels on each blob. A N-by-1 matrix.
centroid
The center-of-mass point (x,y) for each blob. A N-by-2-matrix.
upperLeft
The upper left corner of the blob's bounding box. Each row in the matrix contains the (x,y) coordinates of a point. A N-by-2 matrix.
upperRight
The upper right corner of the blob's bounding box.
lowerLeft
The lower left corner of the blob's bounding box.
lowerRight
The lower right corner of the blob's bounding box.
majorDirection
Normalized major direction vector (x,y) for each blob. A N-by-2 matrix.
minorDirection
Normalized minor direction vector (x,y) for each blob. A N-by-2 matrix.
majorVariance
Relative size of each blob along the major direction vector in a statistical sense. A N-by-1 matrix.
minorVariance
Relative size of each blob along the minor direction vector in a statistical sense. A N-by-1 matrix.
majorMinorRatio
Ratio of major and minor variances. A N-by-1 matrix.
size
The size of the bounding box of each detected blob in world coordinates (width, height). A N-by-2 matrix.
frame
A coordinate frame for each detected blob. Each frame is a 4-by-4 matrix totaling in a 4N-by-4 matrix.