Ask Your Question

Revision history [back]

If you have grayscale video originally, then reading a frame from the stream, using the videoCapture interface will give you a fake BGR channel result, because all three channels will have the same intensity values set. You do not need a convert anymore, and you can basically split channels.

VideoCapture cap(0); // open the default camera
Mat frame, channel;
vector<Mat> channels;
cap >> frame; // get a new frame from camera
split(frame, channels);

Mat intensities_grey = channels[0];