Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

draw_rect

Draw rectangle on image


Description

Add a rectangle to an image. Like other native CImg drawing functions, this is meant to be basic but fast. Use implot for flexible drawing.

Usage

draw_rect(im, x0, y0, x1, y1, color = "white", opacity = 1, filled = TRUE)

Arguments

im

an image

x0

x coordinate of the bottom-left corner

y0

y coordinate of the bottom-left corner

x1

x coordinate of the top-right corner

y1

y coordinate of the top-right corner

color

either a vector, or a string (e.g. "blue")

opacity

0: transparent 1: opaque.

filled

fill rectangle (default TRUE)

Value

an image

Author(s)

Simon Barthelme

See Also

implot,draw_circle

Examples

draw_rect(boats,1,1,50,50,"darkgreen") %>% plot

imager

Image Processing Library Based on 'CImg'

v0.42.10
LGPL-3
Authors
Simon Barthelme [aut], David Tschumperle [ctb], Jan Wijffels [ctb], Haz Edine Assemlal [ctb], Shota Ochi [cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.