drawPolyline: Draw Polygonal Lines on an Image

View source: R/draw.R

drawPolylineR Documentation

Draw Polygonal Lines on an Image

Description

drawPolyline draws polygonal lines over an Image object. This operation is destructive: it changes irreversibly the Image object and cannot be undone.

Usage

drawPolyline(image, line, closed = FALSE, color = "red", thickness = 1)

Arguments

image

An Image object.

line

An m x 2 matrix (or an object that can be converted to an m x 2 matrix) or a list of m x 2 matrices, with the first column containing the x coordinates of the polygonal lines and the second column containing the y coordinates of the polygonal lines.

closed

A boolean indicating whether the drawn polylines are closed or not (default: FALSE). If they are closed, the function draws a line from the last vertex of each curve to its first vertex.

color

A value or vector of any kind of R color specification compatible with col2bgr representing the color to fill the polygon with (default: "white").

thickness

A numeric value representing the thickness in pixels of the line (default: 1).

Value

This function does not return anything. It modifies image in place.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

Image, selectROI, fillConvexPoly

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
poly <- data.frame(x = c(290, 290, 440, 440), y = c(170, 325, 325, 170))
drawPolyline(balloon, poly, closed = FALSE, color = "red", thickness = 3)


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