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.
- 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.
- 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.
- color
- Three element vector of integers representing red, green blue (RGB) colors.
- thickness
- Optional parameter specifying the thickness of the line drawn on handle. Default value of thickness is 1.
- 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.
- shift
- Optional parameter specifying number if fractional bits in handle. Default value is 0.
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);