I use a camera that supports "MJPG" and "YUY2". I found that its default format is "YUY2", but I want to use "MJPG", so I used the code below.
VideoCapture cap(0);
cap.set(CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
cout << CV_FOURCC('M', 'J', 'P', 'G') << endl;
cout << cap.get(CAP_PROP_FOURCC) << endl;
But it turned out below:
1196444237
8.44715e+08
The first one is FOURCC "MJPG" and the second is "YUY2". In the world, setting CAP_PROP_FOURCC failed.
So how to set the video camera format in OpenCV?
source
share