openpose icon indicating copy to clipboard operation
openpose copied to clipboard

Desired webcam resolution ... could not being set. Final resolution: ...

Open jploski opened this issue 11 months ago • 0 comments

Running openpose commit 5c5d96523ef917bd30301245fdc8343937cae48d on Linux with Bus 002 Device 012: ID 046d:080a Logitech, Inc. Portable Webcam C905. Setting resolution via parameter --camera_resolution 640x480 (or any other resolution) does not work. It always falls back to the highest (and lowest FPS) supported resolution (1600x1200) while displaying the error message quoted in title.

Setting the resolution works correctly after the following fix:

diff --git a/src/openpose/producer/videoCaptureReader.cpp b/src/openpose/producer/videoCaptureReader.cpp
index cd42f3b..8731d2d 100644
--- a/src/openpose/producer/videoCaptureReader.cpp
+++ b/src/openpose/producer/videoCaptureReader.cpp
@@ -150,6 +150,7 @@ namespace op
         {
             // Open webcam
             upImpl->mVideoCapture = cv::VideoCapture{index};
+            upImpl->mVideoCapture.open(index, cv::CAP_V4L2);
             // Make sure video capture was opened
             if (throwExceptionIfNoOpened && !isOpened())
                 error("VideoCapture (webcam) could not be opened.", __LINE__, __FUNCTION__, __FILE__);

jploski avatar Jan 01 '25 23:01 jploski