.set() is not working for brightness and exposure on Macbook

asked 2020-07-30 05:52:25 -0600

updated 2020-07-30 06:03:48 -0600

berak gravatar image

Hi, I m using opencv 4.1.2 and Macbook to set camera properties but continously getting False in response for brightness and exposure while height and width are fine. Macbook OpenCV 4.1.2 Logitech Brio 4K

import cv2
import time
cap = cv2.VideoCapture(1,cv2.CAP_AVFOUNDATION)
r=cap.set(3,1920) 
print(r)
r=cap.set(4,1080)
print(r)
time.sleep(2)
r1=cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0)
r=cap.set(cv2.CAP_PROP_EXPOSURE, -7)
print(r1)
print(r)
r=cap.set(cv2.CAP_PROP_BRIGHTNESS,1.0)
print(r)
print(cap.get(cv2.CAP_PROP_BRIGHTNESS))
ret, img = cap.read()
img1="1.jpg"
cv2.imwrite(img1, img)
#cv2.imshow(img)
cap.release()

Response

True
True
False
False
False
0.0
edit retag flag offensive close merge delete

Comments

there is no guarantee ever, that the set() / get() functions will work, given your combination of hw / os / driver / video backend.

berak gravatar imageberak ( 2020-07-30 06:06:42 -0600 )edit

then how to resolve this issue? I have both option either using cli or by using python3 and opencv

Haseebahmad9418 gravatar imageHaseebahmad9418 ( 2020-07-30 08:10:20 -0600 )edit

hw tested using OBS working fine pictures are taken but setting are taking any effect when using with python3. Even resoluton is having effect using python3 and open cv2 as mention above

Haseebahmad9418 gravatar imageHaseebahmad9418 ( 2020-07-30 08:13:01 -0600 )edit

if i read it correctly, the avfoundation wrappers only seem to support this for IOS

berak gravatar imageberak ( 2020-07-30 08:41:13 -0600 )edit