Learn R Programming

imager (version 0.45.8)

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)

Value

an image

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)

Author

Simon Barthelme

See Also

implot,draw_circle

Examples

Run this code
cimg.limit.openmp()
draw_rect(boats,1,1,50,50,"darkgreen") %>% plot

Run the code above in your browser using DataLab