Simplify Contours Filter

Simplifies the contours of all objects in a mask image.

Category

category_image_operation Image Processing

Node

simplifycontours_node

Parameters

Filled: whether to fill the simplified contours. If false they will just be outlined (and not filled).

Trace Width: the width of the lines to use when outlining the contours (has no effect when they are filled). Specified in pixels.

Segment Count: to how many segments the polynomial of each contour is to be attemted to be reduced to. This is only a target, sometimes the algorithm cannot exactly reach the selected number of segments.

Inputs

Input: the input mask

Outputs

Output: the output mask

Effect of the Filter

The filter takes in a mask with one or more objects. For each objects it calculates the contour. It then tries to simplify the contour to reduce the number of polyonmial segments the contour consists of, targeting the Segment Count parameter.

It then generates a new mask that can either contain the contours filled again, or it can outline the contours with a certain trace width.

The following table illustrates the input and output of the filter when applied to a mask with objects of varying sizes, for a segment count of 5:

Before

Filled

Outlined (trace width 4)

simplifycontours_pre

simplifycontours_filled

simplifycontours_outline

See also