Class: Contour

A contour found by a Lens.ContourSearch

Instance Properties

id: String

The ID of this contour. Read-only.

points: Array

Array of x,y-coordinates of points in contour. Read-only.

center: Object

Center of mass. Read-only.

center.x: Number

Center of mass in X dimension.

center.y: Number

Center of mass in Y dimension.

center.z: Number

The Z dimension value for the center of mass. (as distance from model)

moments: Object

Image moments of the contour. (see: http://en.wikipedia.org/wiki/Image_moment) Read-only.

contourChildren: Array

All the child contours of this one.

contourClassification: Number

Gesture classification.

Instance Methods

_end() common/models/contour.js, line 128

Marks this contours as having disappeared.

_update(newPoints, newCm, newMoments, newChildren, newClassification) common/models/contour.js, line 106

Updates the points in the contour

Argument Type Description
newPoints Array

The new points in the contour.

newCm Object

The new center of mass object with x,y,[z] coordinates

newMoments Object

The new images moments of this contour.

newChildren Array

The new children for this contour.

newClassification Number

The new gesture classification.

disappeared(fn) → {Binding} common/models/contour.js, line 150

Registers a function to be called whenever this contour disappears from screen.

Argument Type Description
fn function

The function to call. Gets this contour as an argument.

Returns:

A Binding that allows this handler to be cleared

moved(fn) → {Binding} common/models/contour.js, line 139

Registers a function to be called whenever this contour moves.

Argument Type Description
fn function

The function to call. Gets this contour as an argument.

Returns:

A Binding that allows this handler to be cleared

simplifiedPoints(epsilon) common/models/contour.js, line 163

Returns the points for the contour, simplified by the Ramer–Douglas–Peucker algorithm: http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm

Argument Type Attributes Description
epsilon Number <optional>

Tolerance factor. The lower this is, the more points will be dicarded. Defaults to 5.