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 :
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLUtility as util
Code Example
geometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_UInt8, 510, 509)
img1 = PyIPSDK.createImage(geometry)
util.randomImg(PyIPSDK.createRange(50, 70), img1)
img2 = PyIPSDK.createImage(geometry)
util.randomImg(img2)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLUtility/Processor/RandomImg/RandomImg.h>
Code Example
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);
randomImg(pRange, pInImg);