//by default opencv put channels in BGR order , so in your situation you want to copy the first channel which is blue. Set green and red channels elements to zero.chans[1]=Mat::zeros(img.rows, img.cols, CV_8UC1); // green channel is set to 0chans[2]=Mat::zeros(img.rows, img.cols, CV_8UC1);// red channel is set to 0