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!