opencv 笔记07Core_RND
2013-04-10 17:41
211 查看
随机数发生器类 (RNG)
并得到均匀分布的随机数。
RNG::RNG()
RNG::RNG(uint64 state)
RNG constructors
These are the RNG constructors. The first form sets the state to some pre-defined value, equal to 2**32-1 in
the current implementation. The second form sets the state to the specified value. If the user passed state=0 ,
the constructor uses the above default value instead, to avoid the singular random number sequence, consisting of all zeros.
unsigned RNG::next()
Returns the next random number,The method updates the state using MWC algorithm and returns the next 32-bit random number.int RNG::uniform(int a,
int b)
Returns the next random number sampled from the uniform distribution
double RNG::gaussian(double sigma)
Returns the next random number sampled from t
c4d9
he Gaussian distribution
void putText(Mat& img,
const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, intlineType=8, bool bottomLeftOrigin=false)¶
Draws a text string
函数 putText 都做了些什么?在我们的例子中:
在 image 上绘制文字 “Testing text rendering” 。
文字的左下角将用点 org 指定。
字体参数是用一个在
之间的整数来定义。
字体的缩放比例是用表达式 rng.uniform(0, 100)x0.05 + 0.1 指定(表示它的范围是
)。
字体的颜色是随机的 (记为 randomColor(rng))。
字体的粗细范围是从 1 到 10, 表示为 rng.uniform(1,10) 。
并得到均匀分布的随机数。
RNG::RNG()
RNG::RNG(uint64 state)
RNG constructors
Parameter: | state – the 64-bit value used to initialize the RNG |
---|
the current implementation. The second form sets the state to the specified value. If the user passed state=0 ,
the constructor uses the above default value instead, to avoid the singular random number sequence, consisting of all zeros.
unsigned RNG::next()
Returns the next random number,The method updates the state using MWC algorithm and returns the next 32-bit random number.int RNG::uniform(int a,
int b)
Returns the next random number sampled from the uniform distribution
Parameters: | a – The lower inclusive boundary of the returned random numbers b – The upper non-inclusive boundary of the returned random numbers |
---|
Returns the next random number sampled from t
c4d9
he Gaussian distribution
Parameter: | sigma – The standard deviation of the distribution |
---|
const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, intlineType=8, bool bottomLeftOrigin=false)¶
Draws a text string
Parameters: | img – The image text – The text string to be drawn org – The bottom-left corner of the text string in the image fontFace – The 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 orFONT_HERSHEY_SCRIPT_COMPLEX , where each of the font id’s can be combined with FONT_HERSHEY_ITALIC to get the slanted letters. fontScale – The font scale factor that is multiplied by the font-specific base size color – The text color thickness – Thickness of the lines used to draw the text lineType – The line type; see line for details bottomLeftOrigin – When true, the image data origin is at the bottom-left corner, otherwise it’s at the top-left corner |
---|
putText( image, "Testing text rendering", org, rng.uniform(0,8), rng.uniform(0,100)*0.05+0.1, randomColor(rng), rng.uniform(1, 10), lineType);
函数 putText 都做了些什么?在我们的例子中:
在 image 上绘制文字 “Testing text rendering” 。
文字的左下角将用点 org 指定。
字体参数是用一个在
之间的整数来定义。
字体的缩放比例是用表达式 rng.uniform(0, 100)x0.05 + 0.1 指定(表示它的范围是
)。
字体的颜色是随机的 (记为 randomColor(rng))。
字体的粗细范围是从 1 到 10, 表示为 rng.uniform(1,10) 。
相关文章推荐
- OpenCV学习笔记(五十)——Algorithm类介绍(core)
- opencv 笔记01Core_Mat
- opencv 笔记04Core_Blending
- opencv_笔记_core_basic structures_1117
- OpenCV学习笔记4 OpenCV核心模块与核心功能Core Module & Core Functionality(三)
- 【OpenCV笔记 07】OpenCV中线段的绘制和文本的插入
- 二、openCV学习笔记(The Core Functionality)
- OpenCV学习笔记(五十)——Algorithm类介绍(core)
- OpenCv基础学习笔记之一[core_c.h]
- OpenCV学习笔记6 OpenCV核心模块与核心功能Core Module & Core Functionality(五)
- OpenCV学习笔记07--用滚动条控制图片缩放
- OpenCV学习笔记 存取像素值操作汇总core
- OpenCV学习笔记5 OpenCV核心模块与核心功能Core Module & Core Functionality(四)
- OpenCV学习笔记(四)——新版本的数据结构core
- OpenCV学习笔记2 OpenCV核心模块与核心功能Core Module & Core Functionality(一)
- OpenCV学习笔记(四)——新版本的数据结构core
- OpenCV学习笔记3 OpenCV核心模块与核心功能Core Module & Core Functionality(二)
- OpenCV学习笔记(四十八)——PCA算法实现core
- OpenCV学习笔记——存取像素值操作汇总core
- opencv 笔记02Core_Scan