linecv

Draws a line on the image.

Syntax

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

linecv(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 line section to draw in handle. The line drawn will be clipped to the size of handle.
Type: vector
endpoint
Two-element vector of integers representing the end point of the line section to draw in handle. The line drawn will be clipped to the size of handle.
Type: vector
color
Three element vector of integers representing red, green blue (RGB) colors.
Type: vector
thickness
Optional parameter specifying the thickness of the line drawn on handle. Default value of thickness is 1.
Type: integer
type
Optional parameter specifying the type of the line drawn on handle. Default value of type is 8. 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 if fractional bits in handle. Default value is 0.
Type: integer

Example

Draw a red line with thickness 12 across the diagonal on an image :

handle = imreadcv('bird4.jpg');
handlesz = imsizecv(handle);
linecv(handle, [0 0], [handlesz(2) handlesz(1)], [255 0 0], 12);


Figure 1. Input image


Figure 2. Output image