[mediacapture-image] Add property for controlling exposure time in manual exposure mode

bringert has just created a new issue for https://github.com/w3c/mediacapture-image:

== Add property for controlling exposure time in manual exposure mode ==
# Proposal
* Add an exposureTime dict-member to:
  * MediaTrackSupportedConstraints
  * MediaTrackCapabilities
  * MediaTrackConstraintSet
  * MediaTrackSettings
* exposureTime should be in time units. Which unit exactly doesn't matter too much, as long as it is well-defined.
* Make it clear in the appropriate places that exposureTime is how manual exposure mode is controlled

# Background

The exposureMode property allows for manual exposure mode, but there is currently no property for controlling the exposure time (aka shutter speed, aka exposure duration) in manual exposure mode. 

For comparison, for whiteBalanceMode, there is a colorTemperature property used to control white balance when in manual mode.

Implementations of the spec seem to have hacked around this. For example, the Chrome v4l implementation uses the exposureCompensation to set the exposure time https://cs.chromium.org/chromium/src/media/capture/video/linux/v4l2_capture_delegate.cc?type=cs&sq=package:chromium&l=708

This solution is unsatisfactory, because exposureCompensation is defined to be in EV units, whereas exposure time should be in time units. Not only is the unit conceptually wrong, but this also means that exposureCompensation has a non-sensical range for controlling exposure time, as exposureCompensation can be negative. Also, the current definition exposureCompensation clearly says that it's for controlling auto-exposure.

Ideally, to fully control exposure, there would also be properties for aperture and ISO. However, many of the cameras and APIs that would be used with the image capture API don't seem to support those.

# Underlying APIs
Looking at existing camera APIs, they all tend to have an exposure time control.

## V4L

https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/extended-controls.html
V4L2_CID_EXPOSURE_ABSOLUTE (integer)
Determines the exposure time of the camera sensor. The exposure time is limited by the frame interval. Drivers should interpret the values as 100 µs units, where the value 1 stands for 1/10000th of a second, 10000 for 1 second and 100000 for 10 seconds.

## AVFoundation
https://developer.apple.com/documentation/avfoundation/avcapturedevice/1624606-exposureduration
exposureDuration
The length of time over which exposure takes place.
var exposureDuration: CMTime { get }

## UVC
https://tinyurl.com/uvc-1-5-specification
CT_EXPOSURE_TIME_ABSOLUTE_CONTROL
The Exposure Time (Absolute) Control is used to specify the length of exposure. This value is
expressed in 100μs units, where 1 is 1/10,000th of a second, 10,000 is 1 second, and 100,000 is
10 seconds.

## Android Camera2
https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SENSOR_EXPOSURE_TIME
SENSOR_EXPOSURE_TIME
added in API level 21
Key<Long> SENSOR_EXPOSURE_TIME
Duration each pixel is exposed to light.
If the sensor can't expose this exact duration, it will shorten the duration exposed to the nearest possible value (rather than expose longer). The final exposure time used will be available in the output capture result.
This control is only effective if android.control.aeMode or android.control.mode is set to OFF; otherwise the auto-exposure algorithm will override this value.
Units: Nanoseconds



Please view or discuss this issue at https://github.com/w3c/mediacapture-image/issues/199 using your GitHub account

Received on Wednesday, 7 March 2018 17:41:36 UTC