title: Contrast stretching in Python/ OpenCV
body: <p>Searching Google for <strong>Histogram Equalization Python</strong> or <strong>Contrast Stretching Python</strong> I am directed to the same links from python documentation in <strong>OpenCv</strong> which are actually both related to equalization and not stretching (IMO).</p>
  
  <ol>
  <li><p><a href="http://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.html" rel="noreferrer">http://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.html</a></p></li>
  <li><p><a href="http://docs.opencv.org/3.2.0/d5/daf/tutorial_py_histogram_equalization.html" rel="noreferrer">http://docs.opencv.org/3.2.0/d5/daf/tutorial_py_histogram_equalization.html</a></p></li>
  </ol>
  
  <p>Read the documentation, it seems to be a confusion with the wording, as it describes equalization as a stretching operation:</p>
  
  <blockquote>
    <p>What Histogram Equalization does is to stretch out this range.</p>
  </blockquote>
  
  <p>AND</p>
  
  <blockquote>
    <p>So you need to stretch this histogram to either ends (as given in below image, from wikipedia) and that is what Histogram Equalization does (in simple words)</p>
  </blockquote>
  
  <p>I feel that is wrong because nowhere on Wikipedia it says that <strong>histogram equalization</strong> means stretching, and reading other sources they clearly distinguish the two operations.</p>
  
  <ol>
  <li><a href="http://homepages.inf.ed.ac.uk/rbf/HIPR2/histeq.htm" rel="noreferrer">http://homepages.inf.ed.ac.uk/rbf/HIPR2/histeq.htm</a></li>
  <li><a href="http://homepages.inf.ed.ac.uk/rbf/HIPR2/stretch.htm" rel="noreferrer">http://homepages.inf.ed.ac.uk/rbf/HIPR2/stretch.htm</a></li>
  </ol>
  
  <p><strong>My questions</strong>:</p>
  
  <ol>
  <li><p>does the OpenCV documentation actually implements Histogram Equalization, while badly explaining it?</p>
  
  <ol start="2">
  <li>Is there any implementation for contrast stretching in Python? (OpenCV, etc?)</li>
  </ol></li>
  </ol>