cv3.create.random

cv3.create.random(*args)[source]

Create an array filled with random values between 0 and 255.

Parameters:

*args – Dimensions of the array. Can be passed as separate arguments (e.g., random(100, 100, 3)) or as a tuple.

Returns:

Array filled with random integers [0, 255] of type uint8.

Return type:

numpy.ndarray

Example

>>> import cv3
>>> img = cv3.random(100, 100, 3)  # Create 100x100x3 image with random values
>>> print(img.shape)
(100, 100, 3)
>>> print(0 <= img.min() <= img.max() <= 255)  # All values in valid range
True