Dark AI
Dark AI
DIIDevHeads IoT Integration Server
Created by Enthernet Code on 7/2/2024 in #middleware-and-os
USB Webcam Not Working on Jetson Nano for OpenCV/TensorFlow Object Detection
v4l2-ctl --list-devices
v4l2-ctl --device=/dev/video0 --stream-mmap=3 --stream-count=10
v4l2-ctl --list-devices
v4l2-ctl --device=/dev/video0 --stream-mmap=3 --stream-count=10
If the above steps don't help, try running a simple OpenCV script to verify if OpenCV can access the camera:
import cv2

cap = cv2.VideoCapture(0)

if not cap.isOpened():
print("Cannot open camera")
exit()

while True:
ret, frame = cap.read()
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
cv2.imshow('frame', frame)
if cv2.waitKey(1) == ord('q'):
break

cap.release()
cv2.destroyAllWindows()
import cv2

cap = cv2.VideoCapture(0)

if not cap.isOpened():
print("Cannot open camera")
exit()

while True:
ret, frame = cap.read()
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
cv2.imshow('frame', frame)
if cv2.waitKey(1) == ord('q'):
break

cap.release()
cv2.destroyAllWindows()
10 replies