USB web cam is too slow and can't resize

I’m happy using my two raspberry pi cameras in my jetson nano but I needed to install a USB camera in order to move it with a servo. (1)

The servo part works so I bought a USB HD 1080 camera … but it is too slow and it doesn’t seem to accept resizing without crashing.

I tried:



but I crashes when I do


with this message:
cv2.error: OPENCV(4.1.1) /home/nvidia/host/build/opencv/nv_opencv/modules/highgui/src/window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘imshow’

If I don’t resize it works… but so painfully slow (about a frame a second) that is of no use.

The camera works fine in a windows computer runing the same .py I used on the jetson nano (without the servo part, of course).

Any Ideas?

BTW: I have my two pi cameras connected, but I’m not using them.

BTW2: It works fine in the cheese app and allows resize to 640x480… but with CV2 I don’t seem to be able to do so…

BTW3: I tried the .py with the
on windows and it works with no crashes o warnings.


For running USB cameras on Jetson Nano, please check FAQ.
Q: I have a USB camera. How can I lauch it on Jetson Nano?

Maybe I don’t get it but wanted to use it in cv2…

I found a project to import that solves the problem:

I now can set the width and height when declaring the camera and the rest just goes smoothly…

cam= nano.Camera(camera_type=1,device_id=2,width=640,height=480)

1 Like

You can run sudo jetson_clocks to get max performance. And sudo tegrastats to profile system status. OpenCV may take certain CPU loading. You may consider to use gstreamer or jetson_multimedia_api to get optimal performance on Jetson platforms.