1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
5 ************************
6 Camera Control Reference
7 ************************
9 The Camera class includes controls for mechanical (or equivalent
10 digital) features of a device such as controllable lenses or sensors.
13 .. _camera-control-id:
18 ``V4L2_CID_CAMERA_CLASS (class)``
19 The Camera class descriptor. Calling
20 :ref:`VIDIOC_QUERYCTRL` for this control will
21 return a description of this control class.
23 .. _v4l2-exposure-auto-type:
25 ``V4L2_CID_EXPOSURE_AUTO``
28 enum v4l2_exposure_auto_type -
29 Enables automatic adjustments of the exposure time and/or iris
30 aperture. The effect of manual changes of the exposure time or iris
31 aperture while these features are enabled is undefined, drivers
32 should ignore such requests. Possible values are:
40 * - ``V4L2_EXPOSURE_AUTO``
41 - Automatic exposure time, automatic iris aperture.
42 * - ``V4L2_EXPOSURE_MANUAL``
43 - Manual exposure time, manual iris.
44 * - ``V4L2_EXPOSURE_SHUTTER_PRIORITY``
45 - Manual exposure time, auto iris.
46 * - ``V4L2_EXPOSURE_APERTURE_PRIORITY``
47 - Auto exposure time, manual iris.
51 ``V4L2_CID_EXPOSURE_ABSOLUTE (integer)``
52 Determines the exposure time of the camera sensor. The exposure time
53 is limited by the frame interval. Drivers should interpret the
54 values as 100 µs units, where the value 1 stands for 1/10000th of a
55 second, 10000 for 1 second and 100000 for 10 seconds.
57 ``V4L2_CID_EXPOSURE_AUTO_PRIORITY (boolean)``
58 When ``V4L2_CID_EXPOSURE_AUTO`` is set to ``AUTO`` or
59 ``APERTURE_PRIORITY``, this control determines if the device may
60 dynamically vary the frame rate. By default this feature is disabled
61 (0) and the frame rate must remain constant.
63 ``V4L2_CID_AUTO_EXPOSURE_BIAS (integer menu)``
64 Determines the automatic exposure compensation, it is effective only
65 when ``V4L2_CID_EXPOSURE_AUTO`` control is set to ``AUTO``,
66 ``SHUTTER_PRIORITY`` or ``APERTURE_PRIORITY``. It is expressed in
67 terms of EV, drivers should interpret the values as 0.001 EV units,
68 where the value 1000 stands for +1 EV.
70 Increasing the exposure compensation value is equivalent to
71 decreasing the exposure value (EV) and will increase the amount of
72 light at the image sensor. The camera performs the exposure
73 compensation by adjusting absolute exposure time and/or aperture.
75 .. _v4l2-exposure-metering:
77 ``V4L2_CID_EXPOSURE_METERING``
80 enum v4l2_exposure_metering -
81 Determines how the camera measures the amount of light available for
82 the frame exposure. Possible values are:
84 .. tabularcolumns:: |p{8.7cm}|p{8.8cm}|
90 * - ``V4L2_EXPOSURE_METERING_AVERAGE``
91 - Use the light information coming from the entire frame and average
92 giving no weighting to any particular portion of the metered area.
93 * - ``V4L2_EXPOSURE_METERING_CENTER_WEIGHTED``
94 - Average the light information coming from the entire frame giving
95 priority to the center of the metered area.
96 * - ``V4L2_EXPOSURE_METERING_SPOT``
97 - Measure only very small area at the center of the frame.
98 * - ``V4L2_EXPOSURE_METERING_MATRIX``
99 - A multi-zone metering. The light intensity is measured in several
100 points of the frame and the results are combined. The algorithm of
101 the zones selection and their significance in calculating the
102 final value is device dependent.
106 ``V4L2_CID_PAN_RELATIVE (integer)``
107 This control turns the camera horizontally by the specified amount.
108 The unit is undefined. A positive value moves the camera to the
109 right (clockwise when viewed from above), a negative value to the
110 left. A value of zero does not cause motion. This is a write-only
113 ``V4L2_CID_TILT_RELATIVE (integer)``
114 This control turns the camera vertically by the specified amount.
115 The unit is undefined. A positive value moves the camera up, a
116 negative value down. A value of zero does not cause motion. This is
117 a write-only control.
119 ``V4L2_CID_PAN_RESET (button)``
120 When this control is set, the camera moves horizontally to the
123 ``V4L2_CID_TILT_RESET (button)``
124 When this control is set, the camera moves vertically to the default
127 ``V4L2_CID_PAN_ABSOLUTE (integer)``
128 This control turns the camera horizontally to the specified
129 position. Positive values move the camera to the right (clockwise
130 when viewed from above), negative values to the left. Drivers should
131 interpret the values as arc seconds, with valid values between -180
132 * 3600 and +180 * 3600 inclusive.
134 ``V4L2_CID_TILT_ABSOLUTE (integer)``
135 This control turns the camera vertically to the specified position.
136 Positive values move the camera up, negative values down. Drivers
137 should interpret the values as arc seconds, with valid values
138 between -180 * 3600 and +180 * 3600 inclusive.
140 ``V4L2_CID_FOCUS_ABSOLUTE (integer)``
141 This control sets the focal point of the camera to the specified
142 position. The unit is undefined. Positive values set the focus
143 closer to the camera, negative values towards infinity.
145 ``V4L2_CID_FOCUS_RELATIVE (integer)``
146 This control moves the focal point of the camera by the specified
147 amount. The unit is undefined. Positive values move the focus closer
148 to the camera, negative values towards infinity. This is a
151 ``V4L2_CID_FOCUS_AUTO (boolean)``
152 Enables continuous automatic focus adjustments. The effect of manual
153 focus adjustments while this feature is enabled is undefined,
154 drivers should ignore such requests.
156 ``V4L2_CID_AUTO_FOCUS_START (button)``
157 Starts single auto focus process. The effect of setting this control
158 when ``V4L2_CID_FOCUS_AUTO`` is set to ``TRUE`` (1) is undefined,
159 drivers should ignore such requests.
161 ``V4L2_CID_AUTO_FOCUS_STOP (button)``
162 Aborts automatic focusing started with ``V4L2_CID_AUTO_FOCUS_START``
163 control. It is effective only when the continuous autofocus is
164 disabled, that is when ``V4L2_CID_FOCUS_AUTO`` control is set to
167 .. _v4l2-auto-focus-status:
169 ``V4L2_CID_AUTO_FOCUS_STATUS (bitmask)``
170 The automatic focus status. This is a read-only control.
172 Setting ``V4L2_LOCK_FOCUS`` lock bit of the ``V4L2_CID_3A_LOCK``
173 control may stop updates of the ``V4L2_CID_AUTO_FOCUS_STATUS``
176 .. tabularcolumns:: |p{6.7cm}|p{10.8cm}|
182 * - ``V4L2_AUTO_FOCUS_STATUS_IDLE``
183 - Automatic focus is not active.
184 * - ``V4L2_AUTO_FOCUS_STATUS_BUSY``
185 - Automatic focusing is in progress.
186 * - ``V4L2_AUTO_FOCUS_STATUS_REACHED``
187 - Focus has been reached.
188 * - ``V4L2_AUTO_FOCUS_STATUS_FAILED``
189 - Automatic focus has failed, the driver will not transition from
190 this state until another action is performed by an application.
194 .. _v4l2-auto-focus-range:
196 ``V4L2_CID_AUTO_FOCUS_RANGE``
199 enum v4l2_auto_focus_range -
200 Determines auto focus distance range for which lens may be adjusted.
202 .. tabularcolumns:: |p{6.8cm}|p{10.7cm}|
208 * - ``V4L2_AUTO_FOCUS_RANGE_AUTO``
209 - The camera automatically selects the focus range.
210 * - ``V4L2_AUTO_FOCUS_RANGE_NORMAL``
211 - Normal distance range, limited for best automatic focus
213 * - ``V4L2_AUTO_FOCUS_RANGE_MACRO``
214 - Macro (close-up) auto focus. The camera will use its minimum
215 possible distance for auto focus.
216 * - ``V4L2_AUTO_FOCUS_RANGE_INFINITY``
217 - The lens is set to focus on an object at infinite distance.
221 ``V4L2_CID_ZOOM_ABSOLUTE (integer)``
222 Specify the objective lens focal length as an absolute value. The
223 zoom unit is driver-specific and its value should be a positive
226 ``V4L2_CID_ZOOM_RELATIVE (integer)``
227 Specify the objective lens focal length relatively to the current
228 value. Positive values move the zoom lens group towards the
229 telephoto direction, negative values towards the wide-angle
230 direction. The zoom unit is driver-specific. This is a write-only
233 ``V4L2_CID_ZOOM_CONTINUOUS (integer)``
234 Move the objective lens group at the specified speed until it
235 reaches physical device limits or until an explicit request to stop
236 the movement. A positive value moves the zoom lens group towards the
237 telephoto direction. A value of zero stops the zoom lens group
238 movement. A negative value moves the zoom lens group towards the
239 wide-angle direction. The zoom speed unit is driver-specific.
241 ``V4L2_CID_IRIS_ABSOLUTE (integer)``
242 This control sets the camera's aperture to the specified value. The
243 unit is undefined. Larger values open the iris wider, smaller values
246 ``V4L2_CID_IRIS_RELATIVE (integer)``
247 This control modifies the camera's aperture by the specified amount.
248 The unit is undefined. Positive values open the iris one step
249 further, negative values close it one step further. This is a
252 ``V4L2_CID_PRIVACY (boolean)``
253 Prevent video from being acquired by the camera. When this control
254 is set to ``TRUE`` (1), no image can be captured by the camera.
255 Common means to enforce privacy are mechanical obturation of the
256 sensor and firmware image processing, but the device is not
257 restricted to these methods. Devices that implement the privacy
258 control must support read access and may support write access.
260 ``V4L2_CID_BAND_STOP_FILTER (integer)``
261 Switch the band-stop filter of a camera sensor on or off, or specify
262 its strength. Such band-stop filters can be used, for example, to
263 filter out the fluorescent light component.
265 .. _v4l2-auto-n-preset-white-balance:
267 ``V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE``
270 enum v4l2_auto_n_preset_white_balance -
271 Sets white balance to automatic, manual or a preset. The presets
272 determine color temperature of the light as a hint to the camera for
273 white balance adjustments resulting in most accurate color
274 representation. The following white balance presets are listed in
275 order of increasing color temperature.
277 .. tabularcolumns:: |p{7.2 cm}|p{10.3cm}|
283 * - ``V4L2_WHITE_BALANCE_MANUAL``
284 - Manual white balance.
285 * - ``V4L2_WHITE_BALANCE_AUTO``
286 - Automatic white balance adjustments.
287 * - ``V4L2_WHITE_BALANCE_INCANDESCENT``
288 - White balance setting for incandescent (tungsten) lighting. It
289 generally cools down the colors and corresponds approximately to
290 2500...3500 K color temperature range.
291 * - ``V4L2_WHITE_BALANCE_FLUORESCENT``
292 - White balance preset for fluorescent lighting. It corresponds
293 approximately to 4000...5000 K color temperature.
294 * - ``V4L2_WHITE_BALANCE_FLUORESCENT_H``
295 - With this setting the camera will compensate for fluorescent H
297 * - ``V4L2_WHITE_BALANCE_HORIZON``
298 - White balance setting for horizon daylight. It corresponds
299 approximately to 5000 K color temperature.
300 * - ``V4L2_WHITE_BALANCE_DAYLIGHT``
301 - White balance preset for daylight (with clear sky). It corresponds
302 approximately to 5000...6500 K color temperature.
303 * - ``V4L2_WHITE_BALANCE_FLASH``
304 - With this setting the camera will compensate for the flash light.
305 It slightly warms up the colors and corresponds roughly to
306 5000...5500 K color temperature.
307 * - ``V4L2_WHITE_BALANCE_CLOUDY``
308 - White balance preset for moderately overcast sky. This option
309 corresponds approximately to 6500...8000 K color temperature
311 * - ``V4L2_WHITE_BALANCE_SHADE``
312 - White balance preset for shade or heavily overcast sky. It
313 corresponds approximately to 9000...10000 K color temperature.
317 .. _v4l2-wide-dynamic-range:
319 ``V4L2_CID_WIDE_DYNAMIC_RANGE (boolean)``
320 Enables or disables the camera's wide dynamic range feature. This
321 feature allows to obtain clear images in situations where intensity
322 of the illumination varies significantly throughout the scene, i.e.
323 there are simultaneously very dark and very bright areas. It is most
324 commonly realized in cameras by combining two subsequent frames with
325 different exposure times. [#f1]_
327 .. _v4l2-image-stabilization:
329 ``V4L2_CID_IMAGE_STABILIZATION (boolean)``
330 Enables or disables image stabilization.
332 ``V4L2_CID_ISO_SENSITIVITY (integer menu)``
333 Determines ISO equivalent of an image sensor indicating the sensor's
334 sensitivity to light. The numbers are expressed in arithmetic scale,
335 as per :ref:`iso12232` standard, where doubling the sensor
336 sensitivity is represented by doubling the numerical ISO value.
337 Applications should interpret the values as standard ISO values
338 multiplied by 1000, e.g. control value 800 stands for ISO 0.8.
339 Drivers will usually support only a subset of standard ISO values.
340 The effect of setting this control while the
341 ``V4L2_CID_ISO_SENSITIVITY_AUTO`` control is set to a value other
342 than ``V4L2_CID_ISO_SENSITIVITY_MANUAL`` is undefined, drivers
343 should ignore such requests.
345 .. _v4l2-iso-sensitivity-auto-type:
347 ``V4L2_CID_ISO_SENSITIVITY_AUTO``
350 enum v4l2_iso_sensitivity_type -
351 Enables or disables automatic ISO sensitivity adjustments.
359 * - ``V4L2_CID_ISO_SENSITIVITY_MANUAL``
360 - Manual ISO sensitivity.
361 * - ``V4L2_CID_ISO_SENSITIVITY_AUTO``
362 - Automatic ISO sensitivity adjustments.
368 ``V4L2_CID_SCENE_MODE``
371 enum v4l2_scene_mode -
372 This control allows to select scene programs as the camera automatic
373 modes optimized for common shooting scenes. Within these modes the
374 camera determines best exposure, aperture, focusing, light metering,
375 white balance and equivalent sensitivity. The controls of those
376 parameters are influenced by the scene mode control. An exact
377 behavior in each mode is subject to the camera specification.
379 When the scene mode feature is not used, this control should be set
380 to ``V4L2_SCENE_MODE_NONE`` to make sure the other possibly related
381 controls are accessible. The following scene programs are defined:
387 .. tabularcolumns:: |p{5.9cm}|p{11.5cm}|
393 * - ``V4L2_SCENE_MODE_NONE``
394 - The scene mode feature is disabled.
395 * - ``V4L2_SCENE_MODE_BACKLIGHT``
396 - Backlight. Compensates for dark shadows when light is coming from
397 behind a subject, also by automatically turning on the flash.
398 * - ``V4L2_SCENE_MODE_BEACH_SNOW``
399 - Beach and snow. This mode compensates for all-white or bright
400 scenes, which tend to look gray and low contrast, when camera's
401 automatic exposure is based on an average scene brightness. To
402 compensate, this mode automatically slightly overexposes the
403 frames. The white balance may also be adjusted to compensate for
404 the fact that reflected snow looks bluish rather than white.
405 * - ``V4L2_SCENE_MODE_CANDLELIGHT``
406 - Candle light. The camera generally raises the ISO sensitivity and
407 lowers the shutter speed. This mode compensates for relatively
408 close subject in the scene. The flash is disabled in order to
409 preserve the ambiance of the light.
410 * - ``V4L2_SCENE_MODE_DAWN_DUSK``
411 - Dawn and dusk. Preserves the colors seen in low natural light
412 before dusk and after down. The camera may turn off the flash, and
413 automatically focus at infinity. It will usually boost saturation
414 and lower the shutter speed.
415 * - ``V4L2_SCENE_MODE_FALL_COLORS``
416 - Fall colors. Increases saturation and adjusts white balance for
417 color enhancement. Pictures of autumn leaves get saturated reds
419 * - ``V4L2_SCENE_MODE_FIREWORKS``
420 - Fireworks. Long exposure times are used to capture the expanding
421 burst of light from a firework. The camera may invoke image
423 * - ``V4L2_SCENE_MODE_LANDSCAPE``
424 - Landscape. The camera may choose a small aperture to provide deep
425 depth of field and long exposure duration to help capture detail
426 in dim light conditions. The focus is fixed at infinity. Suitable
427 for distant and wide scenery.
428 * - ``V4L2_SCENE_MODE_NIGHT``
429 - Night, also known as Night Landscape. Designed for low light
430 conditions, it preserves detail in the dark areas without blowing
431 out bright objects. The camera generally sets itself to a
432 medium-to-high ISO sensitivity, with a relatively long exposure
433 time, and turns flash off. As such, there will be increased image
434 noise and the possibility of blurred image.
435 * - ``V4L2_SCENE_MODE_PARTY_INDOOR``
436 - Party and indoor. Designed to capture indoor scenes that are lit
437 by indoor background lighting as well as the flash. The camera
438 usually increases ISO sensitivity, and adjusts exposure for the
439 low light conditions.
440 * - ``V4L2_SCENE_MODE_PORTRAIT``
441 - Portrait. The camera adjusts the aperture so that the depth of
442 field is reduced, which helps to isolate the subject against a
443 smooth background. Most cameras recognize the presence of faces in
444 the scene and focus on them. The color hue is adjusted to enhance
445 skin tones. The intensity of the flash is often reduced.
446 * - ``V4L2_SCENE_MODE_SPORTS``
447 - Sports. Significantly increases ISO and uses a fast shutter speed
448 to freeze motion of rapidly-moving subjects. Increased image noise
449 may be seen in this mode.
450 * - ``V4L2_SCENE_MODE_SUNSET``
451 - Sunset. Preserves deep hues seen in sunsets and sunrises. It bumps
453 * - ``V4L2_SCENE_MODE_TEXT``
454 - Text. It applies extra contrast and sharpness, it is typically a
455 black-and-white mode optimized for readability. Automatic focus
456 may be switched to close-up mode and this setting may also involve
457 some lens-distortion correction.
464 ``V4L2_CID_3A_LOCK (bitmask)``
465 This control locks or unlocks the automatic focus, exposure and
466 white balance. The automatic adjustments can be paused independently
467 by setting the corresponding lock bit to 1. The camera then retains
468 the settings until the lock bit is cleared. The following lock bits
471 When a given algorithm is not enabled, drivers should ignore
472 requests to lock it and should return no error. An example might be
473 an application setting bit ``V4L2_LOCK_WHITE_BALANCE`` when the
474 ``V4L2_CID_AUTO_WHITE_BALANCE`` control is set to ``FALSE``. The
475 value of this control may be changed by exposure, white balance or
484 * - ``V4L2_LOCK_EXPOSURE``
485 - Automatic exposure adjustments lock.
486 * - ``V4L2_LOCK_WHITE_BALANCE``
487 - Automatic white balance adjustments lock.
488 * - ``V4L2_LOCK_FOCUS``
489 - Automatic focus lock.
493 ``V4L2_CID_PAN_SPEED (integer)``
494 This control turns the camera horizontally at the specific speed.
495 The unit is undefined. A positive value moves the camera to the
496 right (clockwise when viewed from above), a negative value to the
497 left. A value of zero stops the motion if one is in progress and has
500 ``V4L2_CID_TILT_SPEED (integer)``
501 This control turns the camera vertically at the specified speed. The
502 unit is undefined. A positive value moves the camera up, a negative
503 value down. A value of zero stops the motion if one is in progress
504 and has no effect otherwise.
506 ``V4L2_CID_CAMERA_ORIENTATION (menu)``
507 This read-only control describes the camera orientation by reporting its
508 mounting position on the device where the camera is installed. The control
509 value is constant and not modifiable by software. This control is
510 particularly meaningful for devices which have a well defined orientation,
511 such as phones, laptops and portable devices since the control is expressed
512 as a position relative to the device's intended usage orientation. For
513 example, a camera installed on the user-facing side of a phone, a tablet or
514 a laptop device is said to be have ``V4L2_CAMERA_ORIENTATION_FRONT``
515 orientation, while a camera installed on the opposite side of the front one
516 is said to be have ``V4L2_CAMERA_ORIENTATION_BACK`` orientation. Camera
517 sensors not directly attached to the device, or attached in a way that
518 allows them to move freely, such as webcams and digital cameras, are said to
519 have the ``V4L2_CAMERA_ORIENTATION_EXTERNAL`` orientation.
527 * - ``V4L2_CAMERA_ORIENTATION_FRONT``
528 - The camera is oriented towards the user facing side of the device.
529 * - ``V4L2_CAMERA_ORIENTATION_BACK``
530 - The camera is oriented towards the back facing side of the device.
531 * - ``V4L2_CAMERA_ORIENTATION_EXTERNAL``
532 - The camera is not directly attached to the device and is freely movable.
536 ``V4L2_CID_CAMERA_SENSOR_ROTATION (integer)``
537 This read-only control describes the rotation correction in degrees in the
538 counter-clockwise direction to be applied to the captured images once
539 captured to memory to compensate for the camera sensor mounting rotation.
541 For a precise definition of the sensor mounting rotation refer to the
542 extensive description of the 'rotation' properties in the device tree
543 bindings file 'video-interfaces.txt'.
545 A few examples are below reported, using a shark swimming from left to
546 right in front of the user as the example scene to capture. ::
549 0 +------------------------------------->
564 Assuming you can bring your laptop with you while swimming with sharks,
565 the camera module of the laptop is installed on the user facing part of a
566 laptop screen casing, and is typically used for video calls. The captured
567 images are meant to be displayed in landscape mode (width > height) on the
570 The camera is typically mounted upside-down to compensate the lens optical
571 inversion effect. In this case the value of the
572 V4L2_CID_CAMERA_SENSOR_ROTATION control is 0, no rotation is required to
573 display images correctly to the user.
575 If the camera sensor is not mounted upside-down it is required to compensate
576 the lens optical inversion effect and the value of the
577 V4L2_CID_CAMERA_SENSOR_ROTATION control is 180 degrees, as images will
578 result rotated when captured to memory. ::
580 +--------------------------------------+
590 +--------------------------------------+
592 A software rotation correction of 180 degrees has to be applied to correctly
593 display the image on the user screen. ::
595 +--------------------------------------+
605 +--------------------------------------+
607 Example two - Phone camera
609 It is more handy to go and swim with sharks with only your mobile phone
610 with you and take pictures with the camera that is installed on the back
611 side of the device, facing away from the user. The captured images are meant
612 to be displayed in portrait mode (height > width) to match the device screen
613 orientation and the device usage orientation used when taking the picture.
615 The camera sensor is typically mounted with its pixel array longer side
616 aligned to the device longer side, upside-down mounted to compensate for
617 the lens optical inversion effect.
619 The images once captured to memory will be rotated and the value of the
620 V4L2_CID_CAMERA_SENSOR_ROTATION will report a 90 degree rotation. ::
623 +-------------------------------------+
633 +-------------------------------------+
635 A correction of 90 degrees in counter-clockwise direction has to be
636 applied to correctly display the image in portrait mode on the device
639 +--------------------+
654 +--------------------+
658 This control may be changed to a menu control in the future, if more
659 options are required.