Histogram Equalization in 5.1 ?

Histogram Equalization in 5.1 ?

Hi,

I'm in need of a histogram equalizer, yet searching the forum brings up a few threads relavent to 4.1 :

w_ipp-sample-image_p_4.1.004.zip iplhist.c iplHistoEqualize It appears that the only samples available to down load now, as of 5.1, do not contain any canned functions to perform histogram equalization. Is there any way to get the older samples and if so would those canned functions (iphist.c, iplHistoEqualize) still work with 5.1? I've heard OpenCV has it, but it'd be nice to get a small and simple ipp func w/o other overhead. If there is not a canned Histeq function available in 5.1, is there a plan to put on in for a future release? Any help would be appreciated, Thanks Matt

12 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Matt,

you may find ippiHistogramRange and ippiHistogramEven functions in IPP. I think you can substitute at least some of old IPL functionality with these functions.

Regards,
Vladimir

Hi Valdimir,

Thanks for the reply. I looked at those two functions, which seem to compute the histogram for you, either with equal bins or not. I guess my fundamental question is - aside from re-writing MATLAB histeq from scratch using IPP, is there any place you can point me towards actually performing the contrast enhancement in just a few steps?

Would it be possible to post the code from the versoin 4 examples that seemed to actually perform the histogram equalization?

Thanks much,

Matt

Hi Matt,

Unfortunately we do not have example for contrast enchancement in the current version of IPP. Please contact with Intel Premier Support regarding obtaining previous version of IPP samples.

Regards,
Vladimir

hmm, I write a small function via call ippiHistogramEven and ippiLUT to implement histogram equalization.

Assume 256 gray levels:

#define GrayLevels 256
Ipp32s histo[GrayLevels];
Ipp32f s[GrayLevels];
Ipp32s levels[GrayLevels+1], values[GrayLevels+1];
//calculate histogram
ippiHistogramEven_8u_C1R(pImage, imgStep, imgSize, histo, levels, GrayLevels+1, 0, GrayLevels);
for (int i = 0; i < GrayLevels; i ++)
{
s[i] = float(histo[i]) / imgSize.width / imgSize.height;
if (i > 0)
s[i] = s[i] + s[i-1];
values[i] = Ipp32s(s[i] * (GrayLevels-1));
}
values[GrayLevels] = GrayLevels;

//LUT
ippiLUT_8u_C1IR(pImage, imgStep, imgSize, values, levels, GrayLevels+1);

Hello and thanks for sharing that piece of code. How do you find performance, does it fit your needs?

Regards,
Vladimir

Now the code runs well and I don't think histogram equalization algorithm will cost too much cpu time:)

Since you methioned the performance problem, I want to ask is there any information about the performance of each function? Sometimes there is more than one way to implement a specific function, but I am not sure which one is faster.

Thanks.

Hello,

information about performance of almost every IPP function is available within IPP installation package, please refer to IPP/tools/perfsys folder. We provide set of CVS (comma separated) files with reports from IPP performance system on several different platforms as well as precompiled IPP perf sys executables which you can run on your particular system and repeat performance measurement.

Regards,
Vladimir

thanks a lot

Hello, 

I am working on Histogram Equlaization in IPP 7.1. I found the sample code posted by atest_1 to be very useful. I get the desired output for my the histogram equalization but I also get a run time error that says 

Run-Time Check Failure #2 - Stack around the variable 'levels' was corrupted.

How do I get rid of this? 


Thanks, 

Sharath

These arrays are used in that test-case:

>>...
>>...histo[GrayLevels];
>>Ipp32f s[GrayLevels];
>>Ipp32f levels[GrayLevels+1], values[GrayLevels+1]...
>>...

It is possible that you have more than 256 gray levels or there is an out-of-bound like bug in your codes.

Sergey: Thanks so much. I got it working now. Yes, I had it more than 256. 

Leave a Comment

Please sign in to add a comment. Not a member? Join today