Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Histogram Equalization in 5.1 ?

yaddayadda22
Beginner
1,423 Views

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

0 Kudos
11 Replies
Vladimir_Dudnik
Employee
1,423 Views

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

0 Kudos
yaddayadda22
Beginner
1,423 Views
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

0 Kudos
Vladimir_Dudnik
Employee
1,423 Views

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

0 Kudos
atest_1
Beginner
1,423 Views

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 = float(histo) / imgSize.width / imgSize.height;
if (i > 0)
s = s + s[i-1];
values = Ipp32s(s * (GrayLevels-1));
}
values[GrayLevels] = GrayLevels;

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

					
				
			
			
				
			
			
			
			
			
			
			
		
0 Kudos
Vladimir_Dudnik
Employee
1,423 Views

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

Regards,
Vladimir

0 Kudos
atest_1
Beginner
1,423 Views

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.

0 Kudos
Vladimir_Dudnik
Employee
1,423 Views

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

0 Kudos
atest_1
Beginner
1,423 Views
thanks a lot
0 Kudos
SharathKum_D_Intel
1,423 Views

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

0 Kudos
SergeyKostrov
Valued Contributor II
1,423 Views
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.
0 Kudos
SharathKum_D_Intel
1,423 Views

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

0 Kudos
Reply