title: opencv - Assertion failed (dst.data == dst0.data) in cvCvtColor
body: <p>The following code will post the error message: </p>
  
  <pre><code>// object is a color image with type cv::Mat
  
  IplImage* temp_object = &amp;(IplImage)object;
  IplImage* ipl_object = cvCreateImage(cvGetSize(temp_object), 8, 3);
  assert(temp_object-&gt;nChannels ==  3 &amp;&amp; temp_object-&gt;depth == IPL_DEPTH_8U);
  assert(ipl_object-&gt;nChannels ==  3 &amp;&amp; ipl_object-&gt;depth == IPL_DEPTH_8U);
  cvCvtColor(ipl_object, temp_object, CV_BGR2GRAY);
  </code></pre>
  
  <p><strong>Error</strong><br></p>
  
  <blockquote>
    <p>OpenCV Error: Assertion failed (dst.data == dst0.data) in cvCvtColor, file /opt/local /var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_opencv/opencv/work/OpenCV-2.3.1/modules/imgproc/src/color.cpp, line 3175
    terminate called throwing an exception`</p>
  </blockquote>
  
  <p>Updated code after modification (it should work now). Thanks for the help!</p>
  
  <pre><code>IplImage temp_object (object);
  IplImage* ipl_object = cvCreateImage(cvGetSize(&amp;temp_object), 8, 1);
  cvCvtColor(&amp;temp_object, ipl_object, CV_BGR2GRAY);
  </code></pre>