Function:Rectangle

From CUVI Wiki


Draws a rectangle of specified color on the image.

Function

CuviStatus rectangle(CuviImage& image,
	             const CuviRect& rect,
                     const CuviScalar& color,
                     const CuviStream& stream = CuviStream());

Parameters

Name Type Description
image CuviImage& Input Image
rect const CuviRect& Region of the image on which to draw the rectangle
color const CuviScalar& Color of the rectangle
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC1 8uC1
8uC3 8uC3


Example

//Read an image from the disk
CuviImage image = cuvi::io::loadImage(path);

//Draw a 100 x 100 rectangle on the image starting from pixel (10,10)
CuviRect rect(10,10,100,100);

//Set the color of the rectangle
CuviScalar redColor(0,0,255);

//Draw the rectangle on the image
cuvi::dataExchange::rectangle(image,rect,color);