[ros-users] webcam: stop automatic whites

Rob Wheeler wheeler at willowgarage.com
Mon Aug 23 17:21:08 UTC 2010


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 <ktossell at umd.edu> 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
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100823/be6c3935/attachment-0003.html>


More information about the ros-users mailing list