Visible to Intel only — GUID: GUID-159D3D3D-AD29-4AE9-B436-A58425EB704F
Visible to Intel only — GUID: GUID-159D3D3D-AD29-4AE9-B436-A58425EB704F
AddRandUniform
Generates random samples with uniform distribution and adds them to an image data.
Syntax
IppStatus ippiAddRandUniform_<mod>(Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, Ipp<datatype> low, Ipp<datatype> high, unsigned int* pSeed);
Supported values for mod:
8u_C1IR | 16u_C1IR | 16s_C1IR | 32f_C1IR |
8u_C3IR | 16u_C3IR | 16s_C3IR | 32f_C3IR |
8u_C4IR | 16u_C4IR | 16s_C4IR | 32f_C4IR |
8u_AC4IR | 16u_AC4IR | 16s_AC4IR | 32f_AC4IR |
Include Files
ippi.h
Domain Dependencies
Headers: ippcore.h, ippvm.h, ipps.h
Libraries: ippcore.lib, ippvm.lib, ipps.lib
Parameters
pSrcDst |
Pointer to the source and destination image ROI. |
srcDstStep |
Distance in bytes between starts of consecutive lines in the source and destination image. |
roiSize |
Size of the image ROI in pixels. |
low |
The lower bound for the range of uniformly distributed values. |
high |
The upper bound for the range of uniformly distributed values. |
pSeed |
The initial seed value for the pseudo-random number generator. |
Description
This function operates with ROI (see Regions of Interest in Intel IPP).
The function generates samples with uniform distribution over the range [low, high] and adds them to a source image pointed to by pSrcDst.
The resulting pixel values that exceed the image data range are saturated to the respective data-range limits. To obtain an image that contains pure noise with uniform distribution, call ippiAddRandUniform using a source image with zero data as input.
Return Values
ippStsNoErr |
Indicates no error. Any other value indicates an error or a warning. |
ippStsNullPtrErr |
Indicates an error when any of the specified pointers is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with zero or negative value. |
ippStsStepErr |
Indicates an error condition if srcDstStep has a zero or negative value. |
Example
The code example below shows data conversion without scaling.
IppStatus randUniform( void ) { unsigned int seed = 123456; Ipp8u img[2048], mn, mx; IppiSize roi={2048,1}; Ipp64f mean; IppStatus st; ippiSet_8u_C1R( 0, img, 2048, roi ); st = ippiAddRandUniform_8u_C1IR(img, 2048, roi, 0, 255, &seed); ippiMean_8u_C1R( img, 2048, roi, &mean ); ippiMinMax_8u_C1R( img, 2048, roi, &mn, &mx ); printf( "[%d..%d], mean=%.3f\n", mn, mx, mean ); return st; }