Re: [ros-users] webcam: stop automatic whites

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Rob Wheeler
Date:  
To: ros-users
Subject: Re: [ros-users] webcam: stop automatic whites
Here is some sample code that I use to set the "Zoom, Absolute" control in
v4l2. You could replace V4L2_CID_ZOOM_ABSOLUTE with
V4L2_CID_AUTO_WHITE_BALANCE to enable/disable auto white-balance.

    struct v4l2_queryctrl queryctrl;
    struct v4l2_control control;


    memset (&queryctrl, 0, sizeof (queryctrl));
    queryctrl.id = V4L2_CID_ZOOM_ABSOLUTE;


    if (-1 == ioctl (capture_fd_, VIDIOC_QUERYCTRL, &queryctrl)) {
      if (errno != EINVAL) {
        perror ("VIDIOC_QUERYCTRL");
        exit (EXIT_FAILURE);
      } else {
        printf ("V4L2_CID_ZOOM_ABSOLUTE is not supported\n");
      }
    } else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) {
      printf ("V4L2_CID_ZOOM_ABSOLUTE is not supported\n");
    } else {
      memset (&control, 0, sizeof (control));
      control.id = V4L2_CID_ZOOM_ABSOLUTE;
      control.value = zoom_factor_;


      if (-1 == ioctl (capture_fd_, VIDIOC_S_CTRL, &control)) {
        perror ("VIDIOC_S_CTRL");
        exit (EXIT_FAILURE);
      }
    }



On Mon, Aug 23, 2010 at 10:01 AM, Ken Tossell <> wrote:

> You also might want to check out libwebcam and its command-line
> configuration utility, uvcdynctrl:
>
> http://www.quickcamteam.net/software/libwebcam
>
> $ uvcdynctrl -d /dev/video0 -g 'White Balance Temperature, Auto'
> 1
> $ uvcdynctrl -d /dev/video0 -s 'White Balance Temperature, Auto' 0
> $ uvcdynctrl -d /dev/video0 -c
> Listing available controls for device /dev/video0:
> [...]
> Focus (absolute)
> Exposure, Auto Priority
> Exposure (Absolute)
> Exposure, Auto
> Backlight Compensation
> Sharpness
> White Balance Temperature
> Power Line Frequency
> Gain
> White Balance Temperature, Auto
> Saturation
> Contrast
> Brightness
>
> - Ken
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>