OpenCV默认情况下是BGR24的方式将数据丢到Mat中,
In header file videoio.hpp:
// Generic camera output modes.
// Currently, these are supported through the libv4l interface only.
enum { CAP_MODE_BGR = 0, // BGR24 (default)
CAP_MODE_RGB = 1, // RGB24
CAP_MODE_GRAY = 2, // Y8
CAP_MODE_YUYV = 3 // YUYV
};
可直接设置模式:
cv::VideoCapture camera = cv::VideoCapture();
camera.open(0);
camera.set(CV_CAP_PROP_MODE, CV_CAP_MODE_YUYV);