title: IplImage to vector<uint8_t>
body: <p>How can I convert <code>IplImage</code> to <code>vector&lt;uint8_t&gt;</code> . I can convert it if I send image path to function like : </p>
  
  <pre><code>bool faceImg::load_file (const string &amp;path, vector&lt;uint8_t&gt; &amp;data)
  {
      data.clear();
  
      std::ifstream is(path.c_str(), std::ios::in | std::ios::binary);
      if (!is.is_open())
          return false;
  
      is.seekg(0, is.end);
      size_t len = (size_t)is.tellg();
      is.seekg(0, is.beg);
      data.resize(len);
      is.read((char*)data.data(), len);
  
      return true;
  }
  </code></pre>
  
  <p>However I want to rewrite function with IplImage from camera capture : </p>
  
  <pre><code>bool faceImg::load_image(IplImage *image, vector&lt;uint8_t&gt; &amp;data)
  {
  
  }
  </code></pre>