Ask Your Question
1

Number of bins in CLAHE?

asked 2016-10-29 12:25:05 -0600

melodisease gravatar image

Hello!

Just like in ImageJ I want to set up CLAHE parameter of "histogram bins" to which (as far as I understand) the excess of pixels are dropped.

According to reference only clipLimit and tilesGridSize can be tuned. Any ideas how to implement the desired one? Thanks!

upd: C++, OpenCV 3.1.0 if necessary.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-10-29 16:07:13 -0600

Tetragramm gravatar image

You would have to re-write the CLAHE functions to accept that. Specifically the CLAHE_CalcLut_Body. Right now it uses the same number of pixels as the range. If you are willing to do factors of 2, (128, 64, 32, ect.) then you can just modify the shift parameter. For arbitrary numbers you just need a re-write.

edit flag offensive delete link more

Comments

Do you mean I need just to update clahe.cpp with default values of 'shift' in templates? I tried either setting defaults in template xxx <... int shift = 2> and replacing 'shift' variables to 2, but the picture hasn't changed, unfortunately. Sorry, do I have to update imgproc lib somehow, or am I wrong in some other way? Thanks!

melodisease gravatar imagemelodisease ( 2016-10-29 16:39:14 -0600 )edit
2

Look at line 417. That's where the value of shift is currently set. I assume you're re-building OpenCV after you make the changes. A shift of 2 will make it 64 bins (256/(2^shift)). You also replace the 256 with 64 for a (slight) performance increase.

And make sure you're not using OpenCL, because you're not changing that.

Tetragramm gravatar imageTetragramm ( 2016-10-29 17:27:32 -0600 )edit

No success yet due to re-building issues, but I got your point concerning the modification of the source. Thanks again!

melodisease gravatar imagemelodisease ( 2016-10-30 05:19:04 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-10-29 12:24:26 -0600

Seen: 428 times

Last updated: Oct 29 '16