title: Contrast stretching in local regions of an image
body: <p>I want to perform contrast stretching on an image. The image is as shown (The data-tips are created by me in MATLAB to give more information about the image, the timestamp is already there on the image).</p>
  <p><img src="https://i.stack.imgur.com/FVp2l.png" alt="enter image description here" /></p>
  <p>Now, how to perform contrast stretching has already been described <a href="https://stackoverflow.com/questions/8680593/how-can-i-change-the-contrast-of-an-image-using-opencv">here</a>. But that formula won't work here since <code>imgMin=0</code> and <code>imgMax=255</code>. So the image would remain unchanged. So my workaround was local contrast stretching. I am unsure as to how to do this (and also relatively fast i.e. I should be able to contrast stretch frames of video and still play video in realtime. I tried histogram equalization, though it produces realtime results in OpenCV, the contrast stretching is not impressive). To understand if the algorithm is working, I am also open to the use of MATLAB.</p>
  <p>I have also shown datatips where you can see the pixel values. I have converted my color image into gray-scale first. In short, the aim is white lanes should become brighter though brightest part of the image takes value 255 (i.e. the sun).</p>