title: Converting data representation in OpenCV C++
body: <p>I have loaded an image (cv::mat) and all the pixels seem to be stored as unsigned chars. I need to convert them to 32-bit floating point type so I can perform some math operations.
  I have tried: </p>
  
  <pre><code>Mat M;
  M = imread("path\\to\\image", CV_LOAD_IMAGE_COLOR);   
  cvtColor( M, M, CV_RGB2GRAY);       
  M.convertTo(M,CV_32F); 
  </code></pre>
  
  <p>as well as initializing like so:</p>
  
  <pre><code>Mat test = Mat(100,100,CV_32F);
  </code></pre>
  
  <p>but they don't seem to do anything, the data is still represented as unsigned chars. How do I convert the cv::mat data representation?</p>