V4L2 help in camera settings

Marios Sampson Dimiou picture Marios Sampson Dimiou · Sep 28, 2014 · Viewed 7k times · Source

I would like to change iris,exposure time and iso parameter using v4l2 lib in linux. I have never used sth like that until now.
I found that i have to change this : V4L2_CID_EXPOSURE_AUTO; and i will do that with this part of code:

// open capture
int descriptor = v4l2_open("/dev/video0", O_RDWR);

// manual exposure control
v4l2_control c;
c.id = V4L2_CID_EXPOSURE_AUTO;
c.value = V4L2_EXPOSURE_MANUAL;
if(v4l2_ioctl(descriptor, VIDIOC_S_CTRL, &c) == 0)
    cout << "success";

After I would like to change these three camera parameters : iris, exposure time and iso.

But I cannot find how...

Answer

mpromonet picture mpromonet · Oct 24, 2014

Have a look to v4l2 extended control

After setting V4L2_CID_EXPOSURE_AUTO parameter to V4L2_EXPOSURE_MANUAL as you did, you could use V4L2_CID_EXPOSURE_ABSOLUTE and V4L2_CID_IRIS_ABSOLUTE to control exposure and iris.

To set iso parameter, you need to set V4L2_CID_ISO_SENSITIVITY_AUTO to V4L2_CID_ISO_SENSITIVITY_MANUAL, next V4L2_CID_ISO_SENSITIVITY could be set.

You can look to v4l-utils that provide the command line tool v4l2-ctl to control a v4l2 device.