Skip to contents

drawArrow draws arrow segments from the first point to the second over an Image object. This operation is destructive: it changes irreversibly the Image object and cannot be undone.

Usage

drawArrow(
  image,
  pt1_x,
  pt1_y,
  pt2_x,
  pt2_y,
  tip_length = 0.1,
  color = "red",
  thickness = 1
)

Arguments

image

An Image object.

pt1_x

A numeric value or vector representing the x coordinates of the first end of each arrow.

pt1_y

A numeric value or vector representing the y coordinates of the first end of each arrow.

pt2_x

A numeric value or vector representing the x coordinates of the second end of each arrow.

pt2_y

A numeric value or vector representing the y coordinates of the second end of each arrow.

tip_length

A numeric value or vector representing the length of each arrow's tip as a fraction of each arrow's length (default: 0.1).

color

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

thickness

A numeric value or vector representing the thickness in pixels of each arrow (default: 1).

Value

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

See also

Author

Simon Garnier, garnier@njit.edu

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
drawArrow(balloon, 1, 1, ncol(balloon) / 2, nrow(balloon) / 2, thickness = 3)