Table of Contents

Class ConnectedComponent

Namespace
Bonsai.Vision
Assembly
Bonsai.Vision.dll

Represents a collection of measurements extracted from a cluster of connected pixels in an image.

public class ConnectedComponent
Inheritance
ConnectedComponent
Inherited Members

Properties

Area

Gets or sets the number of pixels in the connected component.

public double Area { get; set; }

Property Value

double

Centroid

Gets or sets the center of mass of the connected component.

public Point2f Centroid { get; set; }

Property Value

Point2f

Contour

Gets or sets the polygonal contour from which the connected component properties were extracted. This property might be null if the connected component was created from an image.

public Contour Contour { get; set; }

Property Value

Contour

MajorAxisLength

Gets or sets the length, in pixels, of the major axis of the ellipse fit to the connected component.

public double MajorAxisLength { get; set; }

Property Value

double

MinorAxisLength

Gets or sets the length, in pixels, of the minor axis of the ellipse fit to the connected component.

public double MinorAxisLength { get; set; }

Property Value

double

Orientation

Gets or sets the angle, in radians, between the x-axis and the major axis of the ellipse fit to the connected component.

public double Orientation { get; set; }

Property Value

double

Patch

Gets or sets the image subregion corresponding to the bounding box of the connected component. This property might be null if the connected component was created from a polygonal contour.

public IplImage Patch { get; set; }

Property Value

IplImage

Methods

FromContour(Seq)

Returns a ConnectedComponent derived from the spatial moments of the specified polygon.

public static ConnectedComponent FromContour(Seq currentContour)

Parameters

currentContour Seq

The polygon from which to derive the spatial moments used to initialize the ConnectedComponent.

Returns

ConnectedComponent

A ConnectedComponent object derived from the spatial moments of the polygon. If the area of the connected component is zero, the centroid and orientation angle will be set to NaN.

FromImage(IplImage, bool)

Returns a ConnectedComponent derived from the spatial moments of the specified image.

public static ConnectedComponent FromImage(IplImage image, bool binary = false)

Parameters

image IplImage

The image from which to derive the spatial moments used to initialize the ConnectedComponent.

binary bool

Specifies whether all non-zero pixels should be treated as having a weight of one.

Returns

ConnectedComponent

A ConnectedComponent object derived from the spatial moments of the image. If the area of the connected component is zero, the centroid and orientation angle will be set to NaN.

FromMoments(Moments)

Returns a ConnectedComponent derived from the spatial moments of a polygon or rasterized shape.

public static ConnectedComponent FromMoments(Moments moments)

Parameters

moments Moments

The spatial moments up to third order of a polygon or rasterized shape.

Returns

ConnectedComponent

A ConnectedComponent object derived from the specified spatial moments. If the area of the connected component is zero, the centroid and orientation angle will be set to NaN.