title: Convert binary image into RGB in OpenCV
body: <p>I am using OpenCV 2.4.3 to do foreground detection. I want to convert the result foreground which is binary into RGB image. My code is like this:</p>
  
  <pre><code>cv::VideoCapture cap;
  cap.open ( "test.avi " );
  cv::Mat img;
  cv::Mat finalForeground;
  cv::Mat element( 3, 3, CV_8U, cv::Scalar(1) );
  cv::gpu::GMG_GPU gmgGpu
  
  gmgGpu.initialize ( cv::Size ( 1600, 1200 ) );
  cv::gpu::GpuMat gpuForeground;
  cv::Mat rgbForeground;
  
  for ( int i = 0; i &lt; 500; i ++ )
  {
      cap &gt;&gt; img; 
      cv::gpu::GpuMat gpuImg ( img );    
      gmgGpu.operator()(gpuImg, gpuForeground);
      gpuForeground.download ( finalForeground);
      cv::morphologyEx ( finalForeground, finalForeground, CV::MORPH_CLOSE, element );
      cvCvtColor ( finalForeground, rgbForeground, CV_GRAY2BGR );
   }
  </code></pre>
  
  <p>Then I got an error like this:</p>
  
  <blockquote>
    <blockquote>
      <p>error C2664: 'cvCvtColor' : cannot convert parameter 2 from 'cv::Mat' to 'CvArr *'</p>
      
      <p>No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called</p>
    </blockquote>
  </blockquote>
  
  <p>Could someone give any suggestion for handling this error? Thanks. </p>