title: OpenCV imwrite a float image, which conversion to use?
body: <p>I need to store a float image in OpenCV. Converting it to a CV8U image as suggested by <a href="https://stackoverflow.com/questions/13961789/opencv-imwrite-saving-black-png">@tomriddle_1234</a> still stores a black png. </p>
  
  <pre><code>reference.type() = 5
  reference.channels() = 1
  reference.depth() = 5
  </code></pre>
  
  <p>How can I convert the image to a 8bit or 16bit so that imwrite can store the image, while maintaining it's float property i.e: the stored image is not "washed out colours" due to conversion/loss of precision!</p>
  
  <pre><code>imshow("5t aligned Mean", reference); //Displays the correct image
  //reference.convertTo(reference, CV_8U); //Convert image to 8Bit INCORRECT
  reference.convertTo(reference, CV_8U, 255.0, 1/255.0); //Correct image
  imwrite(subject.c_str(), reference); //Stores a completely black png
  </code></pre>
  
  <p>Any suggestions are much appreciated!</p>