ext-ctrls-camera.rst 27 KB

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