Skip to main content

draw_rect

Function draw_rect 

Source
pub fn draw_rect(
    image: &mut Tensor,
    x: usize,
    y: usize,
    rect_w: usize,
    rect_h: usize,
    color: [f32; 3],
    thickness: usize,
) -> Result<(), ImgProcError>
Expand description

Draw a rectangle on a u8 image. Draw a rectangle on a [H, W, 3] image tensor (values [0, 1]).

(x, y) is the top-left corner, (w, h) is width and height in pixels. thickness specifies line width; 0 fills the rectangle.