資源簡(jiǎn)介
Matlab編寫的CLAHE,非常值得借鑒。

代碼片段和文件信息
function?[Hist]?=?clipHistogram(HistNrBinsClipLimitNrXNrY)
%??This?function?performs?clipping?of?the?histogram?and?redistribution?of?bins.
%??The?histogram?is?clipped?and?the?number?of?excess?pixels?is?counted.?Afterwards
%??the?excess?pixels?are?equally?redistributed?across?the?whole?histogram?(providing
%??the?bin?count?is?smaller?than?the?cliplimit).
for?i?=?1:NrX
????for?j?=?1:NrY
????????%???Calculate?the?total?number?of?excess?pixels.
????????NrExcess?=?0;
????????for?nr?=?1:NrBins
????????????excess=Hist(ijnr)?-?ClipLimit;
????????????if?excess?>?0
????????????????NrExcess?=?NrExcess?+?excess;
????????????end
????????end
????????%??Clip?histogram?and?redistribute?excess?pixels?in?each?bin
????????binIncr?=?NrExcess?/?NrBins;
????????upper?=?ClipLimit?-?binIncr;
????????for?nr?=?1:NrBins
????????????if?Hist(ijnr)?>?ClipLimit
????????????????Hist(ijnr)?=?ClipLimit;
????????????else
????????????????if?Hist(ijnr)?>?upper
????????????????????NrExcess?=?NrExcess?+?upper?-?Hist(ijnr);
????????????????????Hist(ijnr)?=?ClipLimit;
????????????????else
????????????????????NrExcess?=?NrExcess?-?binIncr;
????????????????????Hist(ijnr)?=?Hist(ijnr)?+?binIncr;
????????????????end
????????????end
????????end
????????
????????if?NrExcess?>?0
????????????stepSize?=?max(1fix(1+NrExcess/NrBins));
????????????for?nr?=?1:NrBins
????????????????NrExcess?=?NrExcess?-?stepSize;
????????????????Hist(ijnr)?=?Hist(ijnr)?+?stepSize;
????????????????if?NrExcess?1
????????????????????break;
????????????????end
????????????end
????????end
????????
????end
end
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????2406781??2010-04-27?01:56??CLAHE\Contrast_limited_adaptive_histogram_equalization-JoDI-1998.pdf
?????文件?????????516??2008-11-19?18:26??CLAHE\mapHistogram.m
?????文件?????????369??2008-11-19?23:31??CLAHE\makeLUT.m
?????文件????????1637??2008-11-06?19:36??CLAHE\clipHistogram.m
?????文件????????3346??2010-04-27?03:58??CLAHE\runCLAHE.m
?????文件????????3346??2010-04-27?04:27??CLAHE\runCLAHE.m~
?????文件????????1122??2008-11-20?00:22??CLAHE\interpolate.m
?????文件?????????653??2008-11-19?23:50??CLAHE\makeHistogram.m
評(píng)論
共有 條評(píng)論