CLAHE wothout adapthisteq .

2 views (last 30 days)
Marco Rossi
Marco Rossi on 9 May 2016
Edited: DGM on 10 May 2021
Hello, i want to implment a CLAHE without using the command adapthisteq. i was able to implement a simple HE and i thought of using the same method on smaller regions for CLAHE, but i'vejust noticed that doesn't works. Looking at the source code of the command adapthisteq i saw there is defined the variable "ClipLimit" but i don't understand how define (should i define it for any region of interest?) and use it.
Ty for help

Answers (1)

DGM
DGM on 10 May 2021
Edited: DGM on 10 May 2021
I know this is ancient, but I'm browsing and I put answers where the next person can find them.
The ClipLimit parameter adjusts the degree to which the local histogram is flattened. The parameter is given in the range of [0 1], but internally, this is denormalized in a way that is quite instructive. To avoid posting Matlab product code, this code is from the MIMT implementation instead (which shares the same syntax and behavior):
% denormalize the cliplimit
% clim_norm=1 results in AHE without contrast limiting (highest output contrast)
% clim_norm=clim_min results in maximal contrast limiting (lowest output contrast)
tilepxcount=prod(tilesize); % number of pixels per tile
clim_min=ceil(tilepxcount/numbins); % lowest contrast is when hgram is totally flat
clim=clim_min+round(clim_norm*(tilepxcount-clim_min)); % simple denormalization
This parameter is then used per-tile when leveling each local histogram. That part of the code basically works like this:
  • Find the total amount of excess pixel counts among histogram bins with counts>clim
  • Redistribute those counts to the bins which have room to spare in an iterative process.
The function clipHistogram() and the rest of adapthisteq() has decent comments compared to a lot of functions. With the exception of the interpolator, everything is visible to anyone wanting to understand the code. There are some minor differences between adapthisteq and the MIMT version linked above, so maybe it would be of help to see the same thing written slightly different (for better or worse).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!