OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 28 Oct 2015 09:21:01 -0500Difference of CLAHE between opencv and matlabhttp://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/I am trying to translate our Matlab code into C++ with OpenCV. Among others, finding counter part of adapthist of Matlab in OpenCV is critical. The function does so-called `Contrast-limited adaptive histogram equalization` (CLAHE) Luckily, OpenCV 2.45 came with CLAHE and I can neatly run following code for it.
Ptr<CLAHE> clahe = createCLAHE();
clahe->setClipLimit(3); //****
clahe->setTilesGridSize(Size(8,8));
clahe->apply(input,output);
One problem for matching Matlab result, however, is that ClipLimit in Matlab has range of (0,1) while I don't have any idea about ClipLimit in OpenCV although I think it's usually more than 1.
So could anyone tell me what's the range of ClipLimit in OpenCV and how can it match with the one in Matlab? Wed, 19 Jun 2013 15:37:03 -0500http://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/Answer by Vladislav Vinogradov for <p>I am trying to translate our Matlab code into C++ with OpenCV. Among others, finding counter part of adapthist of Matlab in OpenCV is critical. The function does so-called <code>Contrast-limited adaptive histogram equalization</code> (CLAHE) Luckily, OpenCV 2.45 came with CLAHE and I can neatly run following code for it.</p>
<pre><code>Ptr<CLAHE> clahe = createCLAHE();
clahe->setClipLimit(3); //****
clahe->setTilesGridSize(Size(8,8));
clahe->apply(input,output);
</code></pre>
<p>One problem for matching Matlab result, however, is that ClipLimit in Matlab has range of (0,1) while I don't have any idea about ClipLimit in OpenCV although I think it's usually more than 1.</p>
<p>So could anyone tell me what's the range of ClipLimit in OpenCV and how can it match with the one in Matlab? </p>
http://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/?answer=15456#post-id-15456`clipLimit` parameter in OpenCV has range (0, 256). Real integer clip limit is calculated as
uiClipLimit = fClipLimit * tileSize.width * tileSize.height / 256Thu, 20 Jun 2013 03:00:59 -0500http://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/?answer=15456#post-id-15456Comment by statcomp for <p><code>clipLimit</code> parameter in OpenCV has range (0, 256). Real integer clip limit is calculated as</p>
<pre><code>uiClipLimit = fClipLimit * tileSize.width * tileSize.height / 256
</code></pre>
http://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/?comment=15517#post-id-15517FYI: result values from CLAHE between opencv and matlab do not match even with clipLimit values you suggested. I suspect there is fundamental difference in calculation, maybe in histogram calculation.
Thu, 20 Jun 2013 15:32:55 -0500http://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/?comment=15517#post-id-15517Answer by AMG for <p>I am trying to translate our Matlab code into C++ with OpenCV. Among others, finding counter part of adapthist of Matlab in OpenCV is critical. The function does so-called <code>Contrast-limited adaptive histogram equalization</code> (CLAHE) Luckily, OpenCV 2.45 came with CLAHE and I can neatly run following code for it.</p>
<pre><code>Ptr<CLAHE> clahe = createCLAHE();
clahe->setClipLimit(3); //****
clahe->setTilesGridSize(Size(8,8));
clahe->apply(input,output);
</code></pre>
<p>One problem for matching Matlab result, however, is that ClipLimit in Matlab has range of (0,1) while I don't have any idea about ClipLimit in OpenCV although I think it's usually more than 1.</p>
<p>So could anyone tell me what's the range of ClipLimit in OpenCV and how can it match with the one in Matlab? </p>
http://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/?answer=74583#post-id-74583Vladislav,
Could you please show how to set all parameters for CLAHE? So far I found setClipLimit and setTilesGridSize, but Matlab allows more parameters to be modified.
Thanks.Wed, 28 Oct 2015 09:21:01 -0500http://answers.opencv.org/question/15442/difference-of-clahe-between-opencv-and-matlab/?answer=74583#post-id-74583