Click or drag to resize

RNGFill Method

Fills arrays with random numbers.

Namespace:  OpenCvSharp
Assembly:  OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax
public void Fill(
	InputOutputArray mat,
	DistributionType distType,
	InputArray a,
	InputArray b,
	bool saturateRange = false
)

Parameters

mat
Type: OpenCvSharpInputOutputArray
2D or N-dimensional matrix; currently matrices with more than 4 channels are not supported by the methods, use Mat::reshape as a possible workaround.
distType
Type: OpenCvSharpDistributionType
distribution type, RNG::UNIFORM or RNG::NORMAL.
a
Type: OpenCvSharpInputArray
first distribution parameter; in case of the uniform distribution, this is an inclusive lower boundary, in case of the normal distribution, this is a mean value.
b
Type: OpenCvSharpInputArray
second distribution parameter; in case of the uniform distribution, this is a non-inclusive upper boundary, in case of the normal distribution, this is a standard deviation (diagonal of the standard deviation matrix or the full standard deviation matrix).
saturateRange (Optional)
Type: SystemBoolean
pre-saturation flag; for uniform distribution only; if true, the method will first convert a and b to the acceptable value range (according to the mat datatype) and then will generate uniformly distributed random numbers within the range [saturate(a), saturate(b)), if saturateRange=false, the method will generate uniformly distributed random numbers in the original range [a, b) and then will saturate them, it means, for example, that theRNG().fill(mat_8u, RNG::UNIFORM, -DBL_MAX, DBL_MAX) will likely produce array mostly filled with 0's and 255's, since the range (0, 255) is significantly smaller than [-DBL_MAX, DBL_MAX).
See Also