Unable to set most camera parameters

I am using opencv 4.6.0 under Mac OSX.
USB camera is a Waveshare IMX335-based 5M pixel
I would like to have control of the exposure, contrast and gain.

The following work correctly (both set and get):

w = capture.get(cv2.CAP_PROP_FRAME_WIDTH)
h = capture.get(cv2.CAP_PROP_FRAME_HEIGHT)
f = capture.get(cv2.CAP_PROP_FPS)

These following do NOT work. They always return 0, and set has no effect:

e = capture.get(cv2.CAP_PROP_EXPOSURE)
g = capture.get(cv2.CAP_PROP_GAIN)
c = capture.get(cv2.CAP_PROP_CONTRAST)
s = capture.get(cv2.CAP_PROP_SATURATION)
b = capture.get(cv2.CAP_PROP_BRIGHTNESS)
r = capture.get(cv2.CAP_PROP_FRAME_COUNT)

The manufacturer says that these should work correctly. According to the documentation, the camera “supports UVC protocol”. Is there anything I can experiment with at the opencv end to fix this?

Cheers,
Bruce

why should a live video source have a CAP_PROP_FRAME_COUNT property? that’s for video files.

all the other properties should be available and if they aren’t, it’s an issue with the backend code.

determine the backend that was selected. the VideoCapture object can give you this as a string. you can also set it at creation with the apiPreference parameter.

Thank you again for your help.

My mistake: I thought that the camera would provide an integer count for its frames.

capture.getBackendName() returns “AVFOUNDATION”

I don’t know which backends might be available, or which one(s) to use. Is there a way that I can query to list the available backends? Then I can try them all. Hopefully at least one will work as hoped.

[EDIT] Google found this from 2019:

This also seems relevant:
https://github.com/webcamoid/webcamoid/issues/333

[FURTHER EDIT]

A look at Apple’s AVFoundation current documentation indicates that exposure controls are supported starting from Mac OS 10.7, see

Cheers,
Bruce