fitEllipse: Fit an Ellipse Around a Set of 2D Points

View source: R/shape.R

fitEllipseR Documentation

Fit an Ellipse Around a Set of 2D Points

Description

fitEllipse calculates the ellipse that fits a set of 2D points.

Usage

fitEllipse(x, y, method = "original")

Arguments

x

A vector of x coordinates.

y

A vector of y coordinates of the same lenght as x.

method

A character string indicating the method to use in order to fit the ellipse. It can take the following values:

  • 'original': least square.

  • 'ams': Approximate Mean Square (AMS) proposed in Taubin (1991).

  • 'direct': Direct least square method proposed in Fitzgibbon, Pilu, and Fisher (1999).

Value

A list containing the height and width (in pixels) of the ellipse, the angle (in degrees) of its main axis with respect to the vertical axis, and the x and y coordinates of its center.

Author(s)

Simon Garnier, garnier@njit.edu

References

Taubin G. Estimation of planar curves, surfaces, and nonplanar space curves defined by implicit equations with applications to edge and range image segmentation. IEEE Trans Pattern Anal Mach Intell. 1991;13: 1115–1138. doi:10.1109/34.103273

Fitzgibbon A, Pilu M, Fisher RB. Direct least square fitting of ellipses. IEEE Trans Pattern Anal Mach Intell. 1999;21: 476–480. doi:10.1109/34.765658

See Also

minAreaRect, boxPoints

Examples

fitEllipse(rnorm(100), rnorm(100))


swarm-lab/Rvision documentation built on Feb. 7, 2024, 4:59 a.m.