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.
- startpoint
- Two-element vector of integers representing the start point of the rectangle to draw in handle.
- endpoint
- Two-element vector of integers representing the end point of the rectangle to draw in handle.
- color
- Three element vector of integers representing red, green blue (RGB) colors that the rectangle will be drawn in.
- thickness
- Optional parameter specifying the thickness of the rectangle. Default value of thickness is 1.
- 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.
- shift
- Optional parameter specifying number of fractional bits in handle. Default value is 0.
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);