title: Splitting a color image into three channels using Open CV and C++?
body: <p>I am new to Open CV, so please forgive me if my question sounds stupid. So, i was studying about this new concept of splitting a BGR channel to individual channels using the split function. I was reading this article(<a href="http://answers.opencv.org/question/37132/i-want-to-split-and-show-r-b-g-pictures-why-does-it-not-work/" rel="nofollow">http://answers.opencv.org/question/37132/i-want-to-split-and-show-r-b-g-pictures-why-does-it-not-work/</a>) and i could not understand the code. So, please can anyone explain me the following line of code as i am really wanted to understand the concept.</p>
  
  <p>I did not understand the create blue channel part at all. Please can anyone explain me a bit?</p>
  
  <pre><code>src = imread("pic.png");
  vector&lt;mat&gt; spl(3);
  split(src,spl);
  
  Mat empty_image =  Mat::zeros(src.rows, src.cols, CV_8UC1);
  
  
  Mat result_blue(src.rows, src.cols, CV_8UC3); // notice the 3 channels here!
  
  // Create blue channel
  Mat in1[] = { spl[0], empty_image, empty_image };
  int from_to1[] = { 0,0, 1,1, 2,2 };
  mixChannels( in1, 3, &amp;result_blue, 1, from_to1, 3 );
  
  imshow("blue image", result_blue);
  </code></pre>