Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

The OpenCV from OpenVINO for Rpi can't set resolution ratio of webcam

王__济维
Beginner
932 Views

Hello! 

I have a Rpi 3B+ and NCS2, the OpenVINO toolkit is already running in system.

But , when I use opencv (version is 4.0.1-OpenVINO) , I can’t set resolution ratio of webcam by using cv2.VideoCapture.set()

My camera is Logitech C525 , and opencv 3.3.0 can set it’s resolution ratio , set() return “True”.

In 4.0.1-OpenVINO run function “set()” will make camera restart and set() return a "False"

What should I do?

Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Dec 23 13:35:21 2018 from 192.168.1.131
[setupvars.sh] OpenVINO environment initialized
pi@raspberrypi:~ $ python2
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2 as cv
>>> cv.__version__
'3.3.0'
>>> cap = cv.VideoCapture(0)
>>> cap.get(3)
640.0
>>> cap.get(4)
480.0
>>> cap.set(3, 1280.0)
True
>>> cap.set(4, 720.0)
True
>>> cap.get(3)
1280.0
>>> cap.get(4)
720.0
>>> exit()
pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2 as cv
>>> cv.__version__
'4.0.1-openvino'
>>> cap = cv.VideoCapture(0)
>>> cap.get(3)
1920.0
>>> cap.get(4)
1080.0
>>> cap.set(3, 1280.0)
False
>>> cap.set(4, 720.0)
False
>>> cap.get(3)
1920.0
>>> cap.get(4)
1080.0
>>> exit()
pi@raspberrypi:~ $ 

 

Thanks!

0 Kudos
1 Solution
Maksim_S_Intel
Employee
932 Views

Try to force V4L backend:

cap = cv.VideoCapture(0, cv.CAP_V4L)

 

View solution in original post

0 Kudos
2 Replies
Maksim_S_Intel
Employee
933 Views

Try to force V4L backend:

cap = cv.VideoCapture(0, cv.CAP_V4L)

 

0 Kudos
王__济维
Beginner
932 Views

Maksim S. (Intel) wrote:

Try to force V4L backend:

cap = cv.VideoCapture(0, cv.CAP_V4L)

 

 

It's work, Thank!!

0 Kudos
Reply