You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Video capture resolution stuck in Windows MSMF backend #12822
The result is that you'll get a frame of size x,y pixels (if x,y is one of the resolutions supported by the webcam), but that image is in fact a 640x480 image rescaled to size x,y.
The poster at answers.opencv.org above claims that on the DirectShow backend it appears to work correctly (I've only tried the MSMF backend so far).
For example, below are 3 images captured identically at 640x480, 960x720, and 1600x1200 resolution with the MSMF backend from a Logitech QuickCam Pro 9000 (all those are reported by the camera as supported modes). It's pretty obvious they were all captured at the same resolution, then scaled.
Isn't 3.4 branch already included in opencv-python 4.0?
It only works with DSHOW backend and not MSMF.
Python 3.7.4 (64 bit)
Windows 10
opencv-python==4.0.0.21
opencv-contrib-python==4.0.0.21
Camera: I tried on both a Quanta UVC camera and the webcam on my HP Spectre x360 (I don't know the details). The resolutions is supported by both cameras.
opencv-python==4.0.0.21 is an old version, latest version in pip is 4.2.0.34 The fix for this issue have not been included there yet. You should either build OpenCV for python by yourself (tag 4.3.0) either wait until new version will be available on pip.
Activity
nerdfever commentedon Oct 21, 2018
I confirm that switching to the DirectShow backend fixes this.
It's the MSMF backend that has this problem.
PhilLab commentedon May 31, 2019
I am experiencing the same with
OpenCV 3.4.3. The defaultcv::VideoCapture::open()selects MSMF backend and is not able to change the resolution.Explicitly requesting
cv::CAP_DSHOWworksPython-Regius commentedon Dec 11, 2019
I can confirm that this is still an issue using OpenCV 4.1.2 and that switching to the DirectShow back-end resolves the issue.
Also if you try using a non 4:3 aspect ratio width and height you will get black boarders.
DMardanbegi commentedon Apr 1, 2020
This issue has not been resolved and it still exists with MSMF backend.
mshabunin commentedon Apr 2, 2020
@dmardanbeigi , please provide more details: platform, OpenCV version, camera model, reproducer code.
Please note that the fix for this issue is available only on master and 3.4 branches and has not been released yet.
DMardanbegi commentedon Apr 8, 2020
Isn't 3.4 branch already included in opencv-python 4.0?
It only works with DSHOW backend and not MSMF.
Python 3.7.4 (64 bit)
Windows 10
opencv-python==4.0.0.21
opencv-contrib-python==4.0.0.21
Camera: I tried on both a Quanta UVC camera and the webcam on my HP Spectre x360 (I don't know the details). The resolutions is supported by both cameras.
Here is the code I use:
alalek commentedon Apr 8, 2020
Not exactly.
See release dates instead: https://github.com/opencv/opencv/releases
Order of changing capturing parameters should be:
You have missed fps.
For MSMF mode responds for H/W acceleration.
mshabunin commentedon Apr 8, 2020
opencv-python==4.0.0.21is an old version, latest version in pip is 4.2.0.34 The fix for this issue have not been included there yet. You should either build OpenCV for python by yourself (tag 4.3.0) either wait until new version will be available on pip.DMardanbegi commentedon Apr 8, 2020
Thanks!