title: How to adjust brightness and contrast using min and max values using OpenCV
body: <p>In ImageJ you can adjust the brightness and contrast of an image using minimum and maximum values. You can also use the <code>setMinAndMax()</code> macro function. The dialog looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/j6E8Y.jpg" alt="ImageJ Brightness and Contrast dialog"></p>
  
  <p>It maps each pixel to fit between the minimum and maximum values.</p>
  
  <p>I'm trying to do the same thing in OpenCV (C++). I can change the contrast and brightness using the <code>alpha</code> and <code>beta</code> parameters of <code>Mat::convertTo()</code>, but I don't know how to do it with minimum and maximum values.</p>
  
  <p>In my case I'm using a 12-bit image so the pixel values range from 0 to 4095. I'm not sure if that matters.</p>