Jetson AGX Xavier USB camera launch

Hi,

I have two USB cameras. I want to launch them on Jetson AGX Xavier Developer Kit at same time. I use a pipeline to capture frames from cameras. But I want to change zoom value of camera after cameras are started. But when I use pipeline (Gstreamer), I cannot use the function of opencv which cap.set(feature,value).

So,

  1. Is it possible that start two cameras like cv2.VideoCapture(/dev/video0) and cv2.VideoCapture(/dev/video1) without pipeline?
  2. Is it possible that update pipeline after start cameras to update zoom value of cameras?

Hi,
Not sure but if you run gstreamer pipeline in cv2.VideoCapture(), may not be able to adjust the setting in runtime.

There are some guidance in this webpage:
https://www.e-consystems.com/blog/camera/how-to-access-cameras-using-opencv-with-python/
Please check and give it a try. Looks like cv2.VideoCapture(0) or cv2.VideoCapture(1) can work.

Hi DaneLLL,

When I try to launch cameras via cv2.VideoCapture(0), the set function does not work for saturation, brightness etc. But I can set width and height via set function in run time. My problem is that how I can change the values of these features in run time.
My opencv version is: 4.5.1

and I am using following code to set features of cameras.

import cv2
cap = cv2.VideoCapture(" v4l2src device=/dev/video0 ! image/jpeg, format=MJPG, framerate=60/1, wdth=1280, height=720 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink drop=1 ", cv2.CAP_GSTREAMER)

#cap = cv2.VideoCapture(0)
#cap.set(3, 640)
#cap.set(4, 480)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
cap.set(cv2.CAP_PROP_SHARPNESS, 100)

#cap2 = cv2.VideoCapture(1)
#cap2.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
#cap2.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)

while True:
ret, frame = cap.read()
#ret2, frame2 = cap2.read()
cv2.imshow(“a”,frame)

#cv2.imshow(“b”,frame2)

key = cv2.waitKey(1) & 0xFF
if key == ord(‘q’):
cap.set(cv2.CAP_PROP_SHARPNESS, 100)
cap.set(cv2.CAP_PROP_ZOOM, 550)
#cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
#cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)

cv2.destroyAllWindows()

When I press q on keyboard, I get following warning message on terminal.

setProperty OpenCV | GStreamer warning: GStreamer: unhandled property

Thanks and Regards!

Hi,
We don’t have experience in changing some settings in runtime, may not be able to suggest next. We would suggest go to
https://forum.opencv.org/

This problem is solved!

Anyone who wants to change camera parameters in run time can use v4l2-ctl tool.
The set operation with python:

import os
os.system(“v4l2-ctl -d /dev/video0 --set-ctrl=zoom_absolute=150”)