contourArea: Area of a Contour

View source: R/shape.R

contourAreaR Documentation

Area of a Contour

Description

polyArea computes the surface area of a polygon.

Usage

contourArea(x, y, oriented = FALSE)

Arguments

x

A vector of the x coordinates of the contour vertices.

y

A vector of the y coordinates of the contour vertices.

oriented

A boolean indicating whether to return the oriented area of the contour or not (default: FALSE).

Value

If 'oriented = FALSE', the function return the area in pixels enclosed within the contour. If 'oriented = TRUE', the function returns a signed area value depending on the contour orientation (clockwise or counter-clokwise). Using this feature, you can determine the orientation of a contour by taking the sign of the area.

Note

The function will certainly return a wrong result for contours with self-intersections.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

contourArea(c(0, 1, 1, 0), c(0, 0, 1, 1))


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