findContours: Find Contours in a Binary Image

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/shape.R

Description

findContours retrieves contours from a binary image using the algorithm by Suzuki & Be (1985).

Usage

1
2
findContours(image, mode = "external", method = "simple",
  offset = c(0, 0))

Arguments

image

An 8-bit (8U) single-channel Image object.

mode

Mode of the contour retrieval algorithm. It can take the following values:

  • 'external': retrieves only the extreme outer contours (the default).

  • 'list': retrieves all of the contours without establishing any hierarchical relationships.

  • 'ccomp': 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.

  • 'tree': retrieves all of the contours and reconstructs a full hierarchy of nested contours.

method

Method for approximating the contours. It can take the following values:

  • 'none': stores absolutely all the contour points.

  • 'simple': compresses horizontal, vertical, and diagonal segments and leaves only their end points (the default).

  • 'l1': applies one of the flavors of the Teh-Chin chain approximation algorithm (Teh & Chin, 1989).

  • 'kcos': applies one of the flavors of the Teh-Chin chain approximation algorithm (Teh & Chin, 1989).

offset

A 2-element vector representing the offset by which every contour point should be shifted (default: c(0, 0)). This is useful if the contours are extracted from the image ROI but then should be analyzed in the whole image context.

Value

A list of two data frames:

Author(s)

Simon Garnier, garnier@njit.edu

References

Suzuki, S., and Be, K. (1985). Topological structural analysis of digitized binary images by border following. Computer Vision, Graphics, and Image Processing 30, 32–46. doi:10.1016/0734-189X(85)90016-7.

Teh, C.-H., and Chin, R. T. (1989). On the detection of dominant points on digital curves. IEEE Trans. Pattern Anal. Mach. Intell. 11, 859–872. doi:10.1109/34.31447.

See Also

Image

Examples

1
# TODO

neuroconductor-devel-releases/Rvision documentation built on Oct. 27, 2020, 1:16 p.m.