title: convert Matrix of type CV_32FC1 to CV_64FC1
body: <p>How do I convert a cv::Mat of type CV_32FC1 to the type CV_64FC1 (equivalent to a change from float to double)?</p>
  
  <p>I am opening a Matrix that was saved as XML (<code>cvSave</code>) but as a float. This means that the field <code>&lt;dt&gt;</code> has the value <code>f</code> in the file. I need to change it to <code>d</code> to open it. But I'd rather not do this, instead I'd like to open it directly as a Matrix with elements of type double, or convert it later from float to double. </p>
  
  <p>Below is my code for opening the file. </p>
  
  <pre><code>/** Load cv::Mat from XML file. 
   */
  cv::Mat loadMat(const std::string filename)
  {
      cv::Mat result;
      cv::FileStorage fs(filename, cv::FileStorage::READ);
      fs.getFirstTopLevelNode() &gt;&gt; result;
      return result;
  }
  </code></pre>