FindContour

The FindContour block finds contours in a binary image based on the specified contour predicate.

    FindContour

Library

ComputerVision/Images/Detection

Description

The contour area is calculated as the smallest rectangle that contains the contour.

Mode:

Outermost Contours Only:         retrieves only the extreme outer contours.

All Contours, No Hierarchy:      retrieves all of the contours without establishing any hierarchical relationships.

All Contours, 2 Level Hierarchy: retrieves all of the contours and organizes them into a two-level hierarchy. At the top level, there are external boundaries of the components. At the second level, there are boundaries of the holes. If there is another contour inside a hole of a connected component, it is still put at the top level.

All Contours, Full Hierarchy:    retrieves all of the contours and reconstructs a full hierarchy of nested contours.

Method:

Store All Contour Points:        stores absolutely all the contour points. That is, any 2 subsequent points (x1,y1) and (x2,y2) of the contour will be either horizontal, vertical or diagonal neighbors, that is, max(abs(x1-x2),abs(y2-y1))==1.

Compress Simple Segments:        compresses horizontal, vertical, and diagonal segments and leaves only their end points. For example, an up-right rectangular contour is encoded with 4 points.

Teh-Chin L1 Approximation:       applies one of the flavors of the Teh-Chin chain approximation algorithm.

Teh-Chin KCOS Approximation:     applies one of the flavors of the Teh-Chin chain approximation algorithm.

Parameters

FindContour_0

NameLabelDescriptionData TypeValid Values

mode

Mode

Indicates the contour retrieval mode.

String

'Outermost
Contours
Only'
'All
Contours,
No
Hierarchy'
'All
Contours,
2
Level
Hierarchy'
'All
Contours,
Full
Hierarchy'

method

Method

Indicates the contour approximation method.

String

'Store
All
Contour
Points'
'Compress
Simple
Segments'
'Teh-Chin
L1
Approximation'
'Teh-Chin
KCOS
Approximation'

externalActivation

External activation

This parameter defines if the block receives or inherits an external activation. When External Activation is used, an additional activation port is added to the block. Default is OFF.

Number

0
1

Ports

NameTypeDescriptionIO TypeNumber

src(Binary)

explicit

input

1

contour

explicit

output

1

hierarchy

explicit

output

2

Port 4

activation

input

externalActivation