puttextcv

Adds text on an image.

Syntax

puttextcv(handle, text, startpoint, font, scale, color...)

linecv(handle, text, startpoint, font, scale, color, thickness, type, originbottomleft)

Inputs

handle
Handle of an image.
Type: integer
text
Text to add.
Type: string
startpoint
Two-element vector of integers representing the starting position of where the text will be placed on handle.
Type: vector
font
Font of the text. Valid values are:
0
cv::FONT_HERSHEY_SIMPLEX - normal size sans-serif font.
1
cv::FONT_HERSHEY_PLAIN - small size sans-serif font.
2
cv::FONT_HERSHEY_DUPLEX - more complex sans-serif font than cv::FONT_HERSHEY_SIMPLEX.
3
cv::FONT_HERSHEY_COMPLEX: normal size serif font.
4
cv::FONT_HERSHEY_TRIPLEX - more complex serif font than cv::FONT_HERSHEY_COMPLEX.
5
cv::FONT_HERSHEY_COMPLEX_SMALL - smaller version of cv::FONT_HERSHEY_COMPLEX.
6
cv::FONT_HERSHEY_SCRIPT_SIMPLEX - hand-writing style font.
7
cv::FONT_HERSHEY_SCRIPT_COMPLEX - more complex hand-writing style font than cv::FONT_HERSHEY_SCRIPT_SIMPLEX.
16
cv::FONT_ITALIC - italic.
Type: integer
scale
Font scale factor.
Type: scalar
color
3-element vector of integers representing red, blue, green (RGB) colors of text.
Type: vector
thickness
Optional parameter specifying the thickness of text. Default value is 1.
Type: integer
type
Optional parameter specifying the type of the line to draw text. Default value 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
originbottomleft
Optional flag indicating if origin is bottom left. If false, origin is at top left. Default value is false.
Type: logical

Example

Add a text on an image:

handle = imreadcv('bird2.jpg');
imsize = imsizecv(handle);
pos = [imsize(1)/3.5, imsize(2)/6];
font = 7;
scale = 4;
thickness = 2;
linetype = 8;
puttextcv(handle, 'This is a test!!', pos, font,scale, [0 0 139], thickness, linetype, false)
Figure 1. Input image


Figure 2. Image after puttextcv command