IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Functions

Algorithm filling an image with uniform random sampled values. More...

Functions

IPSDKIPLUTILITY_API void ipsdk::imaproc::util::randomImg (const ipsdk::imaproc::attr::RangeConstPtr &pInOptOutputRange, const image::ImagePtr &pOutImg)
 wrapper function for initialization of an image with random values generated using a uniform law on interval specified by 'pInOptOutputRange' argument More...
 
IPSDKIPLUTILITY_API void ipsdk::imaproc::util::randomImg (const image::ImagePtr &pOutImg)
 wrapper function for initialization of an image with random values generated using a uniform law on the whole interval allowed by the output image buffer data type ([0; 255] for a uchar image, for instance) More...
 

Detailed Description

Algorithm filling an image with uniform random sampled values.

This algorithm allows to fill an image with random sampled values using a uniform law based on a linear congruential random number generator on interval optionally specified (by default, this interval equals to the whole range allowed by the output image buffer type)

On output image value are given by :

\[ OutImg[i] = LCG_{InOptOutputRange}() \]

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InOptOutputRange [Input Optional] expected output image range X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation X

Global Rule description

Global rule description for algorithm :
ipsdk::processor::ifIsSet (
 _pInOptOutputRange, (ipsdk::imaproc::matchImageRange<ipsdk::imaproc::attr::Range::Min>(_pOutImg,_pInOptOutputRange) && ipsdk::imaproc::matchImageRange<ipsdk::imaproc::attr::Range::Max>(_pOutImg,_pInOptOutputRange)))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLUtility as util

Code Example

# create an image geometry
geometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_UInt8, 510, 509)
# create a uniform random image with a given range
img1 = PyIPSDK.createImage(geometry)
util.randomImg(PyIPSDK.createRange(50, 70), img1)
# create a uniform random image with full image range
img2 = PyIPSDK.createImage(geometry)
util.randomImg(img2)

Example of C++ code :

Example informations

Associated library

IPSDKIPLUtility

Header file

Code Example

// creation of an input image
ImageGeometryPtr pImageGeometry = geometry2d(imageBufferType, sizeX, sizeY);
boost::shared_ptr<MemoryImage> pInImg(boost::make_shared<MemoryImage>());
pInImg->init(*pImageGeometry);
RangePtr pRange(boost::make_shared<Range>());
pRange->setValue<Range::Min>(fMin);
pRange->setValue<Range::Max>(fMax);
// initialize image content with random values in specified range
randomImg(pRange, pInImg);
See also
RandomImgLvl1
RandomImgLvl2
RandomImgLvl3

Function Documentation

◆ randomImg() [1/2]

IPSDKIPLUTILITY_API void ipsdk::imaproc::util::randomImg ( const ipsdk::imaproc::attr::RangeConstPtr pInOptOutputRange,
const image::ImagePtr pOutImg 
)

wrapper function for initialization of an image with random values generated using a uniform law on interval specified by 'pInOptOutputRange' argument

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ randomImg() [2/2]

IPSDKIPLUTILITY_API void ipsdk::imaproc::util::randomImg ( const image::ImagePtr pOutImg)

wrapper function for initialization of an image with random values generated using a uniform law on the whole interval allowed by the output image buffer data type ([0; 255] for a uchar image, for instance)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure