Mask-Based Object Detector Filter

Detects objects in an image based on a mask or a classification image.

Category

category_object_detection Object Detection

Node

maskbasedobjectdetector_node

Parameters

Morphological smoothing: whether to automatically perform a specific morphological smoothing operation before applying the object detection logic. This exists mainly to provide compatibility with fluxTrainer version 1.x and 2.x, which always included this operation; newer models should use the Kernel Operation filter instead, as this gives much better control over the exact operation.

Minimum Object Area: the minimum number of pixels that must belong to an object. If the object is smaller it will be ignored.

Maximum Object Area: the maximum number of pixels that may belong to an object. If the object is larger it will be ignored

Minimum Object Height: the minimum number of pixels an object must extend in the y direction; if it is smaller it will be ignored

Maximum Object Height: the maximum number of pixels an object may extend in the y direction; if it is larger it will be ignored

Minimum Object Width: the minimum number of pixels an object must extend in the x direction; if it is smaller it will be ignored

Maximum Object Width: the maximum number of pixels an object may extend in the x direction; if it is larger it will be ignored

Inputs

Mask/Classification the input mask or classification result

Outputs

Objects: the detected objects

Effect of the Filter

The input of this filter must be an image that consists either of a mask (as produced by e.g. a Thresholding or Background Masking filter), or a classification result (as produced by e.g. a Distance Classifier or SVM filter).

The filter will attempt to find contiguous objects in the given input. It will output an entry for each individual object that was found and that fulfilled the criteria specified in the parameters.

Take for example the following classification image (size is 100 by 100 pixels):

_images/maskbasedobjectdetector_input_classification.png

The corresponding mask that just differentiates between background and foreground would look like this:

_images/maskbasedobjectdetector_input_mask.png

When the mask-based object detector filter is applied to that mask (with the minimum object area set to 1 for the purpose of these examples), it will detect three objects:

_images/maskbasedobjectdetector_output_mask.png

Each detected object will have the following columns:

Internal Name

Human-Readable Name

Explanation

CenterOfGravity.X

Center (x)

The center of gravity of the object in pixels, but as a set of floating point numbers.

CenterOfGravity.Y

Center (y)

Area

Area

The area of the object in pixels.

BoundingBox.X

Left (x)

The rectangular bounding box of the object with coordinates in pixels.

BoundingBox.Y

Top (y)

BoundingBox.Width

Width (x)

BoundingBox.Height

Height (y)

Mask

Mask

A mask that is the size of the bounding box of the object, that defines which pixels belong to the object, and which pixels within the bounding box do not belong to the object. Filters that use detected objects may use this mask to look up pixel-based data that belongs to the object.

If the object detector is applied to the original classification image instead, it will differentiate between more objects:

_images/maskbasedobjectdetector_output_classification.png

Since the object detector was applied to a classification result it will also include the class that specific object belongs to. This is an additional column that is added in this case:

Internal Name

Human-Readable Name

Explanation

UniqueClass

Class

The class the object belongs to.

Additionally, if two objects of different classes touch, they will be detected as separate objects (which is why in this case the object detector detects four, not three objects). However, the object of a different class that is completely surrounded by the other object will be ignored entirely, which is why there is no fifth object to be found.

For having objects classified, but using the behavior of the mask for the detection of the objects (e.g. not separating objects of different classes), it is possible to use the object detector on the pure mask data, and then use a Per-Object Counter filter in combination with a Object Reclassification filter to apply the class to the object.

Sequenced Operations (Line Cameras)

The object detection filter also works with line cameras (or in the case of hyperspectral cameras, Push Brooms). In contrast to processing an entire image at the time, the filter will process each line individually. Once it is clear that an object has completed (i.e. the line after no more pixels belonging to that object have appeared) the filter will output that object during that specific line.