Generates random samples with uniform distribution and adds them to an image data.
IppStatus ippiAddRandUniform_Direct_<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 |
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. |
The function ippiAddRandUniform_Direct is declared in the ippi.h file. It 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_Direct using a source image with zero data as input.
Example “Random Samples Generating” shows data conversion without scaling.
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. |
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_Direct_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;
}Copyright © 2000 - 2011, Intel Corporation. All rights reserved.