drawRectangle: Draw Rectangles on an 'Image'

View source: R/draw.R

drawRectangleR Documentation

Draw Rectangles on an Image

Description

drawRectangle draws rectangles over an Image object. This operation is destructive: it changes irreversibly the Image object and cannot be undone.

Usage

drawRectangle(image, pt1_x, pt1_y, pt2_x, pt2_y, color = "red", thickness = 1)

Arguments

image

An Image object.

pt1_x

A numeric value or vector representing the x coordinates of a corner of each rectangle.

pt1_y

A numeric value or vector representing the y coordinates of a corner of each rectangle.

pt2_x

A numeric value or vector representing the x coordinates of the corners opposite to pt1.

pt2_y

A numeric value or vector representing the y coordinates of the corners opposite to pt1.

color

A value or vector of any kind of R color specification compatible with col2bgr representing the color of each rectangle's outline (default: "red").

thickness

A numeric value or vector representing the thickness in pixels of each rectangle's outline (default: 1). If negative, then a filled rectangle is drawn.

Value

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

Author(s)

Simon Garnier, garnier@njit.edu

See Also

Image, drawRotatedRectangle

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
drawRectangle(balloon, 290, 170, 440, 325, thickness = 3)


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