title: Encoding CV_32FC1 Mat data with base64
body: <p>Hello I am trying to extract the data from a SURF descriptor, when I try this with an ORB descriptor it works. When I use the SURF one the program quits with a segmentation fault 11 on the base64 encode line, I use the base64 function from this site: <a href="http://www.adp-gmbh.ch/cpp/common/base64.html" rel="nofollow">Encoding and decoding base64</a>.</p>
  
  <p>The exact problem is that the format for the ORB descriptor is <code>CV_8UC1</code> and the SURF descriptor <code>CV_32FC1</code>. So I must base64 encode a 32 bit float instead of a 8 bit unsigned char.</p>
  
  <p>How can I do this?</p>
  
  <pre><code>Mat desc;
  vector&lt;KeyPoint&gt; kp;
  
  SurfFeatureDetector detector(500);
  SurfDescriptorExtractor extractor;
  // OrbDescriptorExtractor extractor; This works
  
  detector.detect(image, kp);
  extractor.compute(image, kp, desc);
  
  desc.convertTo(desc, CV_8UC1, 255, 0);
  
  unsigned char const* inBuffer = reinterpret_cast&lt;unsigned char const*&gt;(desc.data);
  unsigned int in_len = desc.total();
  string code = base64_encode(inBuffer, in_len).c_str(); // This line causes the error
  </code></pre>