Computes the intensity histogram of an image.
Case 1: Operation on one-channel integer data
IppStatus ippiHistogramRange_<mod>(const Ipp<datatype>* pSrc, int srcStep, IppiSize roiSize, Ipp32s* pHist, const Ipp32s* pLevels, int nLevels);
Supported values for mod:
8u_C1R |
16u_C1R |
16s_C1R |
Case 2: Operation on multi-channel integer data
IppStatus ippiHistogramRange_<mod>(const Ipp<datatype>* pSrc, int srcStep, IppiSize roiSize, Ipp32s* pHist[3], const Ipp32s* pLevels[3], int nLevels[3]);
Supported values for mod :
8u_C3R |
16u_C3R |
16s_C3R |
8u_AC4R |
16u_AC4R |
16s_AC4R |
IppStatus ippiHistogramRange_<mod>(const Ipp<datatype>* pSrc, int srcStep, IppiSize roiSize, Ipp32s* pHist[4], const Ipp32s* pLevels[4], int nLevels[4]);
Supported values for mod :
8u_C4R |
16u_C4R |
16s_C4R |
Case 3: Operation on one-channel floating-point data
IppStatus ippiHistogramRange_32f_C1R(const Ipp32f* pSrc, int srcStep, IppiSize roiSize, Ipp32s* pHist, const Ipp32f* pLevels, int nLevels);
Case 4: Operation on multi-channel floating-point data
IppStatus ippiHistogramRange_<mod>(const Ipp32f* pSrc, int srcStep, IppiSize roiSize, Ipp32s* pHist[3], const Ipp32f* pLevels[3], int nLevels[3]);
Supported values for mod:
32f_C3R |
32f_AC4R |
IppStatus ippiHistogramRange_32f_C4R(const Ipp32f* pSrc, int srcStep, IppiSize roiSize, Ipp32s* pHist[4], const Ipp32f* pLevels[4], int nLevels[4]);
pSrc |
Pointer to the source image ROI. |
srcStep |
Distance in bytes between starts of consecutive lines in the source image. |
roiSize |
Size of the source ROI in pixels. |
pHist |
Pointer to the computed histogram. In case of multi-channel data, pHist is an array of pointers to the histogram for each channel. |
pLevels |
Pointer to the array of level values. In case of multi-channel data, pLevels is an array of pointers to the level values array for each channel. |
nLevels |
Number of levels, separate for each channel. |
The function ippiHistogramRange is declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP). This function computes the intensity histogram of an image in the ranges specified by the array (or arrays, in case of multi-channel data) pLevels. The histograms computed separately for each channel are stored in the arrays pHist. Before calling this function, the array pLevels should be initialized to determine bounds of the bins for histogram computing. Length of the arrays pLevels and pHist is defined by the nLevels parameter. Since nLevels is the number of levels, the number of histogram bins is nLevels - 1. Similarly, the number of values in the array pHist is also nLevels - 1. The meaning of pHist and pLevels values can be illustrated by the following example: pHist [k] is the number of source image pixels pSrc(x,y) that satisfy the condition
pLevels[k] ≤ pSrc(x,y) < pLevels[k+1].
The following code example shows how to use the ippiHistogramRange function:
// Compute histogram of an image for 4 bins in the range [28, 127]
{
Ipp8u img[WIDTH*HEIGHT];
IppiSize imgSize = {WIDTH, HEIGHT};
const Ipp32s levels[5] = {28, 50, 70, 90, 128};
Ipp32s histo[5];
ippiHistogramRange_8u_C1R(img, WIDTH, imgSize, levels, histo, 5);
// after executing the function the array histo
// will contain a histogram in specified range.
// Actually, four result values will be stored
// compute cumulative histogram
for (i = 1; i < 4; i ++)
histo[i]+= histo[i-1];
}
ippStsNoErr |
Indicates no error. Any other value indicates an error or a warning. |
ippStsNullPtrErr |
Indicates an error if one of the specified pointers is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with zero or negative value. |
ippStsMemAllocErr |
Indicates an error if there is not enough memory for the inner histogram. |
ippStsHistoNofLevelsErr |
Indicates an error if nLevels is less than 2. |
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.