IPSDK 0.2
IPSDK : Image Processing Software Development Kit
void randomImg (inOptOutputRange,outImg)
void randomImg (outImg)

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}() \]

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

Header file

#include <IPSDKIPL/IPSDKIPLUtility/Processor/RandomImg/RandomImg.h>

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);