title: Machine Vision 8bit Bayer RGGB to RGB in Open CV
body: <p>I am currently trying to convert an 8bit Raw color image to 8 bit RGB. 
  i get a channel error it expect the Bayer to be 1 channel. </p>
  
  <p>i am using the following code. </p>
  
  <pre><code>if (convertBayerChckBox-&gt;Checked)
          {
              try{
                  cv::Mat temp(imgOriginal.rows, imgOriginal.cols, CV_8UC3);
                  imgOriginal.copyTo(temp);
                  cv::cvtColor(temp, imgOriginal, CV_BayerRG2BGR);
              }
              catch (const cv::Exception&amp; ex)
              {
                  std::cout &lt;&lt; "EXCEPTION: " &lt;&lt; ex.what() &lt;&lt; std::endl;
                  errLog &lt;&lt; "EXCEPTION: " &lt;&lt; ex.what() &lt;&lt; std::endl;
              }
          }
  </code></pre>
  
  <p>then i am getting the following exception: 
  EXCEPTION: ......\modules\imgproc\src\color.cpp:4194: error: (-215) scn == 1 &amp;&amp; dcn == 3 in function cv::cvtColor</p>
  
  <p>I am not sure how else to convert from Bayer to RGB  </p>