title: How to get Magic Color effect like Cam Scanner using OpenCV
body: <p>This is the original image.</p>
  
  <p><a href="https://i.stack.imgur.com/E7t3p.png" rel="noreferrer"><img src="https://i.stack.imgur.com/E7t3p.png" alt="Orignal Image"></a></p>
  
  <p>Cam Scanner Magic color effect.<a href="https://i.stack.imgur.com/KcnSW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KcnSW.png" alt="Cam Scanner effect"></a></p>
  
  <p>My filter on the image.</p>
  
  <p><a href="https://i.stack.imgur.com/N0mRJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N0mRJ.png" alt="My filter"></a></p>
  
  <p>I am changing the contrast of the image.</p>
  
  <pre><code>dst.convertTo(dst, -1, 2, 0);
  </code></pre>
  
  <p>Then using Gaussian blur for smoothing.</p>
  
  <pre><code>cv::GaussianBlur(dst,result,cv::Size(0,0),3);
  cv::addWeighted(dst, 1.5, result, -0.5, 0, result);
  </code></pre>
  
  <p>What should I do achieve that kind of effect on my image ? </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After Histogram Equilization -</p>
  
  <pre><code>vector&lt;Mat&gt; channels;
  Mat img_hist_equalized;
  cvtColor(dst, img_hist_equalized, CV_BGR2YCrCb);
  split(img_hist_equalized,channels);
  equalizeHist(channels[0], channels[0]);
  merge(channels,img_hist_equalized);
  cvtColor(img_hist_equalized, img_hist_equalized, CV_YCrCb2BGR);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kyfLe.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kyfLe.png" alt="Histogram Equilization"></a></p>