# Region Feature Extraction vTool#

The Region Feature Extraction vTool extracts features from a region.

Typically, you would use the Region Feature Extraction vTool after the Region Morphology vTool to extract characteristic features for subsequent decision-making or result output.

If you use the Calibration vTool before extracting features and connect the Transformation output/input pins of both vTools, the transformation data supplied by the Calibration vTool allows the Region Feature Extraction vTool to output image features in world coordinates in meters (outpin pins with the suffix _m become available).

## How It Works#

You can extract the following features from a region:

• Area: This is the number of pixels of a region or its area in square meters if you're supplying transformation data via the Calibration vTool.
• Center of gravity: This is the center of the region.
• Axis-aligned bounding box: This is the smallest axis-aligned rectangle around a region. This means that all pixels of the region are enclosed by the bounding box, and all borders of the box are touching at least one region pixel.
• Oriented bounding box: This is the smallest arbitrarily-oriented rectangle around a region. This means that all pixels of the region are enclosed by the bounding box, and all borders of the box are touching at least one region pixel. The orientation of the box is determined such that the area of the box is minimized.
• Roundness: Roundness is a measure of how similar a region is to a circle. It is calculated based on the distances between the pixels at the edge of the region to the center of the region. Roundness is expressed by the following formula:
Roundness = 1 – distance deviation / distance mean
A perfect circle has a roundness of one.
• Rectangularity: Rectangularity is a measure of how similar a region is to a rectangle. It is calculated by first determining a rectangle that best fits the region. Then, the relative difference between the area of the input region and the area of the best-fit rectangle counterpart is determined. A perfect rectangle has a rectangularity of one.

## Configuring the vTool#

To configure the Region Feature Extraction vTool:

1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
The Region Feature Extraction dialog opens.
2. Choose the region features you want to extract.

You can view the result of the feature extraction in a pin data view. Here, you can select which outputs to display.

## Inputs#

### Regions#

Accepts a single or multiple regions.

• Data type: Region, Region Array

### Transformation#

Accepts transformation data from the Calibration vTool.

• Data type: Transformation Data

## Outputs#

### Areas_px#

Returns the regions' area in pixels.

• Data type: Float Array

### Areas_m#

Returns the regions' area in square meters.

• Data type: Float Array

### Centers_px#

Returns the regions' center in pixel coordinates.

• Data type: PointF Array

### Centers_m#

Returns the regions' center in world coordinates in meters.

• Data type: PointF Array

### AlignedBoxes_px#

Returns the smallest axis-aligned bounding boxes enclosing the regions in pixel coordinates.

• Data type: RectangleF Array

### AlignedBoxes_m#

Returns the smallest axis-aligned bounding boxes enclosing the regions in world coordinates in meters.

• Data type: RectangleF Array

### OrientedBoxes_px#

Returns the smallest arbitrarily-oriented bounding boxes enclosing the regions in pixel coordinates.

• Data type: RectangleF Array

### OrientedBoxes_m#

Returns the smallest arbitrarily-oriented bounding boxes enclosing the regions in world coordinates in meters.

• Data type: RectangleF Array

### Roundness#

Returns the regions' roundness.

• Data type: Float Array

### Rectangularity#

Returns the regions' rectangularity.

• Data type: Float Array