this erorr message appears on running simple camera capture on Ubuntu with logitech C270 (OpenCV 2.4.2/C++):
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
and further:
Corrupt JPEG data: 2 extraneous bytes before marker 0xd1 Corrupt JPEG data: 1 extraneous bytes before marker 0xd6 Corrupt JPEG data: 1 extraneous bytes before marker 0xd0 Corrupt JPEG data: 1 extraneous bytes before marker 0xd0
I get frames but the values of frame width and height swapped when writing to a Mat object see below:
Mat frame;
videoCapture = new VideoCapture(camId);
if(!videoCapture->isOpened()) throw Exception();
cout << "Frame width: " << videoCapture->get(CV_CAP_PROP_FRAME_WIDTH) << endl;
cout << "Frame height: " << videoCapture->get(CV_CAP_PROP_FRAME_HEIGHT) << endl;
(*videoCapture) >> frame;
cout << "Mat width: " << frame.rows << endl;
cout << "Mat height: " << frame.cols << endl;
Output:
Frame width: 640
Frame height: 480
Mat width: 480
Mat height: 640
The width of an image is given by its number of columns. Your code should be
cout << "Mat width: " << frame.cols << endl;
cout << "Mat height: " << frame.rows << endl;
So there is no swap between width and height.