title: how does HDR worked, how to make HDR effect
body: <p>I had read a blog <a href="http://www.cromwell-intl.com/3d/histogram/" rel="nofollow">Histogram Equalization for Image Enhancement</a> which gives 7 steps to convert normal images to a HDR image (below).
  It's said that a C/C++ program for histogram equalization can easily written using the Open Computer Vision Library or OpenCV. The major steps of such a program include:</p>
  
  <ol>
  <li><p>Read the input image. This can be in most any image format thanks to OpenCV. This input image contains <code>n</code> pixels: <code>n = height × width</code></p></li>
  <li><p>Convert from RGB (curiously stored in the order blue, green, red by OpenCV) to HSV: Hue, Saturation, and Value.</p></li>
  <li><p>Calculate the histogram of the input image. This is a 256 value array, where <code>H[x]</code> contains the number of pixels with value <code>x</code>.</p></li>
  <li><p>Calculate the cumulative density function of the histogram. This is a 256 value array, where <code>cdf[x]</code> contains the number of pixels with value <code>x</code> or less:
  <code>cdf[x] = H[0] + H[1] + H[2] + ... + H[x]</code></p></li>
  <li><p>Loop through the <code>n</code> pixels in the entire image and replace the value at each <code>i</code>'th point: <code>V[i] &lt;-- floor(255*(cdf[V[i]] - cdf[0])/(n - cdf[0]))</code></p></li>
  <li><p>Convert the image back from HSV to RGB.</p></li>
  <li><p>Save the image in the desired format and file name.</p></li>
  </ol>
  
  <p>At step 3, I do not understand what <code>H[x]</code> is? Does <code>x</code> refer to the R, G, B, or H, S, or V values? Also, at step 5 what the meaning of the value <code>i</code>?</p>