rectanglecv

Draws a rectangle on the image.

Syntax

rectanglecv(handle, startpoint, endpoint, color...)

rectanglecv(handle, startpoint, endpoint, color, thickness, type, shift)

Inputs

handle
Handle of the image.
Type: integer
startpoint
Two-element vector of integers representing the start point of the rectangle to draw in handle.
Type: vector
endpoint
Two-element vector of integers representing the end point of the rectangle to draw in handle.
Type: vector
color
Three element vector of integers representing red, green blue (RGB) colors that the rectangle will be drawn in.
Type: vector
thickness
Optional parameter specifying the thickness of the rectangle. Default value of thickness is 1.
Type: integer
type
Optional parameter specifying the line type. Default value is 8 and valid values are:
1
Filled line.
4
Line is drawn using 4-connected Bresenham algorithm.
8(default)
Line is drawn using 8-connected Bresenham algorithm.
16
Antialiased line.
Type: integer
shift
Optional parameter specifying number of fractional bits in handle. Default value is 0.
Type: integer

Example

Draw a red rectangle with thickness 12 in an image :

handle = imreadcv('bird3.jpg');
handlesz = imsizecv(handle);
rectanglecv(handle, [0 0], [handlesz(2) handlesz(1) - 600], [255 0 0], 12);
imshowcv(handle);
Figure 1. Input image


Figure 2. Image after executing rectanglecv