cpp_draw: Draw Shape to Image

View source: R/RcppExports.R

cpp_drawR Documentation

Draw Shape to Image

Description

low-level function to add shape on image

Arguments

img

an IntegerVector. A non null array of dimensions [nrow, ncol, 4].

coords

an IntegerMatrix whose rows are points to draw and with:
- 1st column being img col coordinate in px,
- 2nd column being img row coordinate in px.

mask

a LogicalMatrix where every true value will be added to the image.

color,

a 4 rows IntegerMatrix specifying rgba, from 0 to 255.

blur_size,

a R_len_t the size of the gaussian blurring kernel. Default is 9.

blur_sd,

a double the sd of the gaussian blurring kernel. Default is 3.0.

Details

shape according to 'mask' will be drawn on 'img' centered at coordinates coords[, 1], coords[, 0] and every pixels being part of the shape will be filled with 'color'. If only one 'color' is provided, this 'color' will be used for each points. If more than one 'color' is provided, then if number of colors (ncol) equals the number of points 'color' will be used as is for each single point. Otherwise, 'color' will be considered as a color-gradient and density will be computed. /!\ please note that IFC:::densCols() is faster to compute color based on density for n < 20000 points, so it's worth using it when number of points are lower.

Value

/!\ nothing is returned but img is modified in-place


IFC documentation built on Sept. 14, 2023, 1:08 a.m.