title: OpenCV convert CV_8U to CV_64F
body: <p>I am trying to convert a grayscale image to the type CV64F. From the OpenCv documentation I have understood that a grayscale image is of the type CV_8U. I have also found that imshow plots different types differently, hence I need to divide by 255 before converting. But after converting the image I still get many saturated pixels.</p>
  
  <p>I am using this image, saved as a jpg: 
  <a href="http://www.ele.uri.edu/~hansenj/projects/ele585/lab2/cameraman.gif" rel="nofollow">http://www.ele.uri.edu/~hansenj/projects/ele585/lab2/cameraman.gif</a></p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include &lt;iostream&gt;
  #include &lt;cstring&gt;
  #include &lt;cmath&gt;
  
  int main()
  {
      Mat I, input_image;
      string path = "C:/&lt;your_path&gt;/camera_man.jpg";
      input_image = imread(path.c_str(), 0); // Read the file as grayscale
  
      imshow("Original", input_image);
  
      // Convert image to CV_64F
      input_image *= (double) 1 / 255;
      input_image.convertTo(I, CV_64F);
      imshow("Converted", I);
  
  }
  </code></pre>