1. Random Color
The method of taking the random number from the OPENCV, using the steps:
0xFFFFFFFF= rng.uniform (lower limit, upper limit);
2. Display text
voidPuttext (mat& img,Const string& text, point org,intFontface,DoubleFontscale, Scalar color,intthickness=1,intLinetype=8,BOOLbottomleftorigin=false) Img–image.text–textstringTo be drawn.org–bottom-left corner of the textstring inchThe image.font–cvfont structure initializedusingInitfont (). Fontface–font type. One of Font_hershey_simplex, Font_hershey_plain, Font_hershey_duplex, Font_hershey_complex, FONT_HERSHEY_TRIPLEX, Font_hershey_complex_small, Font_hershey_script_simplex, or Font_hershey_script_complex,whereEach of the font ID ' s can is combined with font_italic toGetThe slanted Letters.fontscale–font scale factor that isMultiplied by the font-specificBaseSize.color–text color.thickness–thickness of the lines used to draw a text.linetype–line type. See the line forDetails.bottomleftorigin–whentrue, the image data origin isAt the Bottom-left corner. Otherwise, it isAt the Top-left corner.
How to use:
" Testing text Rendering ", org, rng.uniform (0,8), Rng.uniform (0,+) *0.05+ 0.1, Randomcolor (RNG), Rng.uniform (1), Linetype);
3. End
OPENCV Introduction: (VII: OPENCV random number and display text)