CameraControl
This message is used for controlling the Camera. The message handles things like capturing still images, configuring auto focus, anti banding, white balance, scenes, effects etc.Examples of functionality
Reference
class
dai::CameraControl
variable
uint64_t cmdMask
variable
AutoFocusMode autoFocusMode
variable
uint8_t lensPosition
Lens/VCM position, range: 0..255. Used with
- max 255: macro focus, at 8cm distance
- infinite focus at about 120..130 (may vary from module to module)
- lower values lead to out-of-focus (lens too close to the sensor array)
variable
float lensPositionRaw
variable
uint8_t lensPosAutoInfinity
variable
uint8_t lensPosAutoMacro
variable
ManualExposureParams expManual
variable
RegionParams aeRegion
variable
RegionParams afRegion
variable
AutoWhiteBalanceMode awbMode
variable
SceneMode sceneMode
variable
AntiBandingMode antiBandingMode
variable
CaptureIntent captureIntent
variable
ControlMode controlMode
variable
EffectMode effectMode
variable
FrameSyncMode frameSyncMode
variable
StrobeConfig strobeConfig
variable
StrobeTimings strobeTimings
variable
uint32_t aeMaxExposureTimeUs
variable
bool aeLockMode
variable
bool awbLockMode
variable
int8_t expCompensation
variable
int8_t brightness
variable
int8_t contrast
variable
int8_t saturation
variable
uint8_t sharpness
variable
uint8_t lumaDenoise
variable
uint8_t chromaDenoise
variable
uint16_t wbColorTemp
variable
uint8_t lowPowerNumFramesBurst
variable
uint8_t lowPowerNumFramesDiscard
variable
bool enableHdr
variable
std::vector< std::pair< std::string, std::string > > miscControls
function
CameraControl()
function
~CameraControl()
function
CameraControl & setCaptureStill(bool capture)
Set a command to capture a still image
function
CameraControl & setStartStreaming()
Set a command to start streaming
function
CameraControl & setStopStreaming()
Set a command to stop streaming
function
CameraControl & setExternalTrigger(int numFramesBurst, int numFramesDiscard)
Set a command to enable external trigger snapshot modeA rising edge on the sensor FSIN pin will make it capture a sequence of
function
CameraControl & setFrameSyncMode(FrameSyncMode mode)
Set the frame sync mode for continuous streaming operation mode, translating to how the camera pin FSIN/FSYNC is used: input/output/disabled
function
CameraControl & setStrobeSensor(int activeLevel)
Enable STROBE output on sensor pin, optionally configuring the polarity. Note: for many sensors the polarity is high-active and not configurable
function
CameraControl & setStrobeExternal(int gpioNumber, int activeLevel)
Enable STROBE output driven by a MyriadX GPIO, optionally configuring the polarity This normally requires a FSIN/FSYNC/trigger input for MyriadX (usually GPIO 41), to generate timings
function
CameraControl & setStrobeDisable()
Disable STROBE output
function
CameraControl & setAutoFocusMode(AutoFocusMode mode)
Set a command to specify autofocus mode. Default
function
CameraControl & setAutoFocusTrigger()
Set a command to trigger autofocus
function
CameraControl & setAutoFocusLensRange(int infinityPosition, int macroPosition)
Set autofocus lens range,
function
CameraControl & setAutoFocusRegion(uint16_t startX, uint16_t startY, uint16_t width, uint16_t height)
Set a command to specify focus region in pixels. Note: the region should be mapped to the configured sensor resolution, before ISP scaling
Parameters
- startX: X coordinate of top left corner of region
- startY: Y coordinate of top left corner of region
- width: Region width
- height: Region height
function
CameraControl & setManualFocus(uint8_t lensPosition)
Set a command to specify manual focus position
Parameters
- lensPosition: specify lens position 0..255
function
CameraControl & setManualFocusRaw(float lensPositionRaw)
Set a command to specify manual focus position (more precise control).
Parameters
- lensPositionRaw: specify lens position 0.0f .. 1.0f
Returns
function
CameraControl & setAutoExposureEnable()
Set a command to enable auto exposure
function
CameraControl & setAutoExposureLock(bool lock)
Set a command to specify lock auto exposure
Parameters
- lock: Auto exposure lock mode enabled or disabled
function
CameraControl & setAutoExposureRegion(uint16_t startX, uint16_t startY, uint16_t width, uint16_t height)
Set a command to specify auto exposure region in pixels. Note: the region should be mapped to the configured sensor resolution, before ISP scaling
Parameters
- startX: X coordinate of top left corner of region
- startY: Y coordinate of top left corner of region
- width: Region width
- height: Region height
function
CameraControl & setAutoExposureCompensation(int compensation)
Set a command to specify auto exposure compensation
Parameters
- compensation: Compensation value between -9..9, default 0
function
CameraControl & setAutoExposureLimit(uint32_t maxExposureTimeUs)
Set a command to specify the maximum exposure time limit for auto-exposure. By default the AE algorithm prioritizes increasing exposure over ISO, up to around frame-time (subject to further limits imposed by anti-banding)
Parameters
- maxExposureTimeUs: Maximum exposure time in microseconds
function
CameraControl & setAutoExposureLimit(std::chrono::microseconds maxExposureTime)
Set a command to specify the maximum exposure time limit for auto-exposure. By default the AE algorithm prioritizes increasing exposure over ISO, up to around frame-time (subject to further limits imposed by anti-banding)
Parameters
- maxExposureTime: Maximum exposure time
function
CameraControl & setAntiBandingMode(AntiBandingMode mode)
Set a command to specify anti-banding mode. Anti-banding / anti-flicker works in auto-exposure mode, by controlling the exposure time to be applied in multiples of half the mains period, for example in multiple of 10ms for 50Hz (period 20ms) AC-powered illumination sources.If the scene would be too bright for the smallest exposure step (10ms in the example, with ISO at a minimum of 100), anti-banding is not effective.
Parameters
- mode: Anti-banding mode to use. Default:
function
CameraControl & setManualExposure(uint32_t exposureTimeUs, uint32_t sensitivityIso)
Set a command to manually specify exposure
Parameters
- exposureTimeUs: Exposure time in microseconds
- sensitivityIso: Sensitivity as ISO value, usual range 100..1600
function
CameraControl & setManualExposure(std::chrono::microseconds exposureTime, uint32_t sensitivityIso)
Set a command to manually specify exposure
Parameters
- exposureTime: Exposure time
- sensitivityIso: Sensitivity as ISO value, usual range 100..1600
function
CameraControl & setAutoWhiteBalanceMode(AutoWhiteBalanceMode mode)
Set a command to specify auto white balance mode
Parameters
- mode: Auto white balance mode to use. Default
function
CameraControl & setAutoWhiteBalanceLock(bool lock)
Set a command to specify auto white balance lock
Parameters
- lock: Auto white balance lock mode enabled or disabled
function
CameraControl & setManualWhiteBalance(int colorTemperatureK)
Set a command to manually specify white-balance color correction
Parameters
- colorTemperatureK: Light source color temperature in kelvins, range 1000..12000
function
CameraControl & setBrightness(int value)
Set a command to adjust image brightness
Parameters
- value: Brightness, range -10..10, default 0
function
CameraControl & setContrast(int value)
Set a command to adjust image contrast
Parameters
- value: Contrast, range -10..10, default 0
function
CameraControl & setSaturation(int value)
Set a command to adjust image saturation
Parameters
- value: Saturation, range -10..10, default 0
function
CameraControl & setSharpness(int value)
Set a command to adjust image sharpness
Parameters
- value: Sharpness, range 0..4, default 1
function
CameraControl & setLumaDenoise(int value)
Set a command to adjust luma denoise amount
Parameters
- value: Luma denoise amount, range 0..4, default 1
function
CameraControl & setChromaDenoise(int value)
Set a command to adjust chroma denoise amount
Parameters
- value: Chroma denoise amount, range 0..4, default 1
function
CameraControl & setSceneMode(SceneMode mode)
Set a command to specify scene mode
Parameters
- mode: Scene mode
function
CameraControl & setEffectMode(EffectMode mode)
Set a command to specify effect mode
Parameters
- mode: Effect mode
function
CameraControl & setMisc(std::string control, std::string value)
Set a miscellaneous control. The controls set by this function get appended to a list, processed after the standard controls
Parameters
- control: Control name
- value: Value as a string
function
CameraControl & setMisc(std::string control, int value)
Set a miscellaneous control. The controls set by this function get appended to a list, processed after the standard controls
Parameters
- control: Control name
- value: Value as an integer number
function
CameraControl & setMisc(std::string control, float value)
Set a miscellaneous control. The controls set by this function get appended to a list, processed after the standard controls
Parameters
- control: Control name
- value: Value as a floating point number
function
void clearMiscControls()
Clear the list of miscellaneous controls set by
function
std::vector< std::pair< std::string, std::string > > getMiscControls()
Get the list of miscellaneous controls set by
Returns
A list of <key, value> pairs as strings
function
CameraControl & setControlMode(ControlMode mode)
Set a command to specify control mode
Parameters
- mode: Control mode
function
CameraControl & setHdr(bool enable)
Whether or not to enable HDR (High Dynamic Range) mode
Parameters
- enable: True to enable HDR mode, false to disable
function
CameraControl & setCaptureIntent(CaptureIntent mode)
Set a command to specify capture intent mode
Parameters
- mode: Capture intent mode
function
bool getCaptureStill()
Check whether command to capture a still is set
Returns
True if capture still command is set
function
std::chrono::microseconds getExposureTime()
Retrieves exposure time
function
int getSensitivity()
Retrieves sensitivity, as an ISO value
function
int getLensPosition()
Retrieves lens position, range 0..255. Returns -1 if not available
function
bool getHdr()
Whether or not HDR (High Dynamic Range) mode is enabled
Returns
True if HDR mode is enabled, false otherwise
inline function
void setCommand(Command cmd, bool value)
inline function
void clearCommand(Command cmd)
inline function
bool getCommand(Command cmd)
inline function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)
function
DEPTHAI_SERIALIZE(CameraControl, cmdMask, autoFocusMode, lensPosition, lensPositionRaw, lensPosAutoInfinity, lensPosAutoMacro, expManual, aeRegion, afRegion, awbMode, sceneMode, antiBandingMode, aeLockMode, awbLockMode, captureIntent, controlMode, effectMode, frameSyncMode, strobeConfig, strobeTimings, aeMaxExposureTimeUs, expCompensation, brightness, contrast, saturation, sharpness, lumaDenoise, chromaDenoise, wbColorTemp, lowPowerNumFramesBurst, lowPowerNumFramesDiscard, enableHdr, miscControls)
function
float getLensPositionRaw()
Retrieves lens position, range 0.0f..1.0f.
struct
dai::CameraControl::ManualExposureParams
variable
uint32_t exposureTimeUs
variable
uint32_t sensitivityIso
variable
uint32_t frameDurationUs
function
DEPTHAI_SERIALIZE(ManualExposureParams, exposureTimeUs, sensitivityIso, frameDurationUs)
struct
dai::CameraControl::RegionParams
variable
uint16_t x
variable
uint16_t y
variable
uint16_t width
variable
uint16_t height
variable
uint32_t priority
function
DEPTHAI_SERIALIZE(RegionParams, x, y, width, height, priority)
struct
dai::CameraControl::StrobeConfig
variable
uint8_t enable
variable
uint8_t activeLevel
variable
int8_t gpioNumber
function
DEPTHAI_SERIALIZE(StrobeConfig, enable, activeLevel, gpioNumber)
struct
dai::CameraControl::StrobeTimings
variable
int32_t exposureBeginOffsetUs
variable
int32_t exposureEndOffsetUs
variable
uint32_t durationUs
function
DEPTHAI_SERIALIZE(StrobeTimings, exposureBeginOffsetUs, exposureEndOffsetUs, durationUs)
enum
uint8_t Command
enumerator
START_STREAM
enumerator
STOP_STREAM
enumerator
STILL_CAPTURE
enumerator
MOVE_LENS
enumerator
AF_TRIGGER
enumerator
AE_MANUAL
enumerator
AE_AUTO
enumerator
AWB_MODE
enumerator
SCENE_MODE
enumerator
ANTIBANDING_MODE
enumerator
EXPOSURE_COMPENSATION
enumerator
AE_LOCK
enumerator
AE_TARGET_FPS_RANGE
enumerator
AWB_LOCK
enumerator
CAPTURE_INTENT
enumerator
CONTROL_MODE
enumerator
FRAME_DURATION
enumerator
SENSITIVITY
enumerator
EFFECT_MODE
enumerator
AF_MODE
enumerator
NOISE_REDUCTION_STRENGTH
enumerator
SATURATION
enumerator
BRIGHTNESS
enumerator
STREAM_FORMAT
enumerator
RESOLUTION
enumerator
SHARPNESS
enumerator
CUSTOM_USECASE
enumerator
CUSTOM_CAPT_MODE
enumerator
CUSTOM_EXP_BRACKETS
enumerator
CUSTOM_CAPTURE
enumerator
CONTRAST
enumerator
AE_REGION
enumerator
AF_REGION
enumerator
LUMA_DENOISE
enumerator
CHROMA_DENOISE
enumerator
WB_COLOR_TEMP
enumerator
EXTERNAL_TRIGGER
enumerator
AF_LENS_RANGE
enumerator
FRAME_SYNC
enumerator
STROBE_CONFIG
enumerator
STROBE_TIMINGS
enumerator
MOVE_LENS_RAW
enumerator
HDR
enum
uint8_t AutoFocusMode
enumerator
OFF
Autofocus disabled. Suitable for manual focus
enumerator
AUTO
Basic automatic focus mode. In this mode, the lens does not move unless the autofocus trigger action is called.
enumerator
MACRO
Close-up focusing mode - this mode is optimized for focusing on objects very close to the camera.
enumerator
CONTINUOUS_VIDEO
In this mode, the AF algorithm modifies the lens position continually to attempt to provide a constantly-in-focus image stream. The focusing behavior should be suitable for good quality video recording; typically this means slower focus movement and no overshoots.
enumerator
CONTINUOUS_PICTURE
In this mode, the AF algorithm modifies the lens position continually to attempt to provide a constantly-in-focus image stream. The focusing behavior should be suitable for still image capture; typically this means focusing as fast as possible
enumerator
EDOF
Extended depth of field (digital focus) mode. The camera device will produce images with an extended depth of field automatically. AF triggers are ignored.
enum
uint8_t AutoWhiteBalanceMode
enumerator
OFF
The camera device's auto-white balance routine is disabled.
enumerator
AUTO
The camera device's auto-white balance routine is active.
enumerator
INCANDESCENT
The camera device's auto-white balance routine is disabled; the camera device uses incandescent light as the assumed scene illumination for white balance.
enumerator
FLUORESCENT
The camera device's auto-white balance routine is disabled; the camera device uses fluorescent light as the assumed scene illumination for white balance.
enumerator
WARM_FLUORESCENT
The camera device's auto-white balance routine is disabled; the camera device uses warm fluorescent light as the assumed scene illumination for white balance.
enumerator
DAYLIGHT
The camera device's auto-white balance routine is disabled; the camera device uses daylight light as the assumed scene illumination for white balance.
enumerator
CLOUDY_DAYLIGHT
The camera device's auto-white balance routine is disabled; the camera device uses cloudy daylight light as the assumed scene illumination for white balance.
enumerator
TWILIGHT
The camera device's auto-white balance routine is disabled; the camera device uses twilight light as the assumed scene illumination for white balance.
enumerator
SHADE
The camera device's auto-white balance routine is disabled; the camera device uses shade light as the assumed scene illumination for white balance.
enum
uint8_t SceneMode
enumerator
UNSUPPORTED
Indicates that no scene modes are set for a given capture request.
enumerator
FACE_PRIORITY
If face detection support exists, use face detection data for auto-focus, auto-white balance, and auto-exposure routines.
enumerator
ACTION
Optimized for photos of quickly moving objects. Similar to SPORTS scene mode.
enumerator
PORTRAIT
Optimized for still photos of people.
enumerator
LANDSCAPE
Optimized for photos of distant macroscopic objects.
enumerator
NIGHT
Optimized for low-light settings.
enumerator
NIGHT_PORTRAIT
Optimized for still photos of people in low-light settings.
enumerator
THEATRE
Optimized for dim, indoor settings where flash must remain off.
enumerator
BEACH
Optimized for bright, outdoor beach settings.
enumerator
SNOW
Optimized for bright, outdoor settings containing snow.
enumerator
SUNSET
Optimized for scenes of the setting sun.
enumerator
STEADYPHOTO
Optimized to avoid blurry photos due to small amounts of device motion (for example: due to hand shake).
enumerator
FIREWORKS
Optimized for nighttime photos of fireworks.
enumerator
SPORTS
Optimized for photos of quickly moving people.
enumerator
PARTY
Optimized for dim, indoor settings with multiple moving people.
enumerator
CANDLELIGHT
Optimized for dim settings where the main light source is a candle.
enumerator
BARCODE
Optimized for accurately capturing a photo of barcode for use by camera applications that wish to read the barcode value.
enum
uint8_t AntiBandingMode
enumerator
OFF
The camera device will not adjust exposure duration to avoid banding problems.
enumerator
MAINS_50_HZ
The camera device will adjust exposure duration to avoid banding problems with 50Hz illumination sources.
enumerator
MAINS_60_HZ
The camera device will adjust exposure duration to avoid banding problems with 60Hz illumination sources.
enumerator
AUTO
The camera device will automatically adapt its antibanding routine to the current illumination condition. This is the default mode if AUTO is available on given camera device.
enum
uint8_t CaptureIntent
enumerator
CUSTOM
The goal of this request doesn't fall into the other categories. The camera device will default to preview-like behavior.
enumerator
PREVIEW
This request is for a preview-like use case.
enumerator
STILL_CAPTURE
This request is for a still capture-type use case.
enumerator
VIDEO_RECORD
This request is for a video recording use case.
enumerator
VIDEO_SNAPSHOT
This request is for a video snapshot (still image while recording video) use case. The camera device should take the highest-quality image possible (given the other settings) without disrupting the frame rate of video recording.
enumerator
ZERO_SHUTTER_LAG
This request is for a ZSL usecase; the application will stream full-resolution images and reprocess one or several later for a final capture.
enum
uint8_t ControlMode
enumerator
OFF
Full application control of pipeline. All control by the device's metering and focusing (3A) routines is disabled.
enumerator
AUTO
Use settings for each individual 3A routine. Manual control of capture parameters is disabled.
enumerator
USE_SCENE_MODE
Use a specific scene mode. Enabling this disables Auto-Exposure, AWB and AF controls;
enum
uint8_t EffectMode
enumerator
OFF
No color effect will be applied.
enumerator
MONO
A "monocolor" effect where the image is mapped into a single color. This will typically be grayscale.
enumerator
NEGATIVE
A "photo-negative" effect where the image's colors are inverted.
enumerator
SOLARIZE
A "solarisation" effect (Sabattier effect) where the image is wholly or partially reversed in tone.
enumerator
SEPIA
A "sepia" effect where the image is mapped into warm gray, red, and brown tones.
enumerator
POSTERIZE
A "posterization" effect where the image uses discrete regions of tone rather than a continuous gradient of tones.
enumerator
WHITEBOARD
A "whiteboard" effect where the image is typically displayed as regions of white, with black or grey details.
enumerator
BLACKBOARD
A "blackboard" effect where the image is typically displayed as regions of black, with white or grey details.
enumerator
AQUA
An "aqua" effect where a blue hue is added to the image.
enum
uint8_t FrameSyncMode
enumerator
OFF
enumerator
OUTPUT
enumerator
INPUT
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.