Class CameraControl

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class CameraControl : public dai::Buffer

CameraControl message. Specifies various camera control commands like:

  • Still capture

  • Auto/manual focus

  • Auto/manual white balance

  • Auto/manual exposure

  • Anti banding

By default the camera enables 3A, with auto-focus in CONTINUOUS_VIDEO mode, auto-white-balance in AUTO mode, and auto-exposure with anti-banding for 50Hz mains frequency.

Public Types

enum class Command : uint8_t

Values:

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 class AutoFocusMode : uint8_t

Values:

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 class AutoWhiteBalanceMode : uint8_t

Values:

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 class SceneMode : uint8_t

Values:

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 class AntiBandingMode : uint8_t

Values:

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 class CaptureIntent : uint8_t

Values:

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 class ControlMode : uint8_t

Values:

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 class EffectMode : uint8_t

Values:

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 class FrameSyncMode : uint8_t

Values:

enumerator OFF
enumerator OUTPUT
enumerator INPUT

Public Functions

CameraControl() = default
CameraControl &setCaptureStill(bool capture)

Set a command to capture a still image

CameraControl &setStartStreaming()

Set a command to start streaming

CameraControl &setStopStreaming()

Set a command to stop streaming

CameraControl &setExternalTrigger(int numFramesBurst, int numFramesDiscard)

Set a command to enable external trigger snapshot mode

A rising edge on the sensor FSIN pin will make it capture a sequence of numFramesBurst frames. First numFramesDiscard will be skipped as configured (can be set to 0 as well), as they may have degraded quality

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

CameraControl &setStrobeSensor(int activeLevel = 1)

Enable STROBE output on sensor pin, optionally configuring the polarity. Note: for many sensors the polarity is high-active and not configurable

CameraControl &setStrobeExternal(int gpioNumber, int activeLevel = 1)

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

CameraControl &setStrobeDisable()

Disable STROBE output

CameraControl &setAutoFocusMode(AutoFocusMode mode)

Set a command to specify autofocus mode. Default CONTINUOUS_VIDEO

CameraControl &setAutoFocusTrigger()

Set a command to trigger autofocus

CameraControl &setAutoFocusLensRange(int infinityPosition, int macroPosition)

Set autofocus lens range, infinityPosition < macroPosition, valid values 0..255. May help to improve autofocus in case the lens adjustment is not typical/tuned

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

CameraControl &setManualFocus(uint8_t lensPosition)

Set a command to specify manual focus position

Parameters:

lensPosition – specify lens position 0..255

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:

CameraControl&

CameraControl &setAutoExposureEnable()

Set a command to enable auto exposure

CameraControl &setAutoExposureLock(bool lock)

Set a command to stop the auto-exposure algorithm. The latest AE sensor configuration is kept.

Parameters:

lock – Auto exposure lock mode enabled or disabled

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

CameraControl &setAutoExposureCompensation(int compensation)

Set a command to specify auto exposure compensation. This modifies the brightness target with positive nubers making the image brighter and negative numbers making the image darker.

Parameters:

compensation – Compensation value between -9..9, default 0

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

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

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: MAINS_50_HZ

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

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

CameraControl &setAutoWhiteBalanceMode(AutoWhiteBalanceMode mode)

Set a command to specify auto white balance mode

Parameters:

mode – Auto white balance mode to use. Default AUTO

CameraControl &setAutoWhiteBalanceLock(bool lock)

Set a command to specify auto white balance lock

Parameters:

lock – Auto white balance lock mode enabled or disabled

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

CameraControl &setBrightness(int value)

Set a command to adjust image brightness

Parameters:

value – Brightness, range -10..10, default 0

CameraControl &setContrast(int value)

Set a command to adjust image contrast

Parameters:

value – Contrast, range -10..10, default 0

CameraControl &setSaturation(int value)

Set a command to adjust image saturation

Parameters:

value – Saturation, range -10..10, default 0

CameraControl &setSharpness(int value)

Set a command to adjust image sharpness

Parameters:

value – Sharpness, range 0..4, default 1

CameraControl &setLumaDenoise(int value)

Set a command to adjust luma denoise amount

Parameters:

value – Luma denoise amount, range 0..4, default 1

CameraControl &setChromaDenoise(int value)

Set a command to adjust chroma denoise amount

Parameters:

value – Chroma denoise amount, range 0..4, default 1

CameraControl &setSceneMode(SceneMode mode)

Set a command to specify scene mode

Parameters:

mode – Scene mode

CameraControl &setEffectMode(EffectMode mode)

Set a command to specify effect mode

Parameters:

mode – Effect mode

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

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

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

void clearMiscControls()

Clear the list of miscellaneous controls set by setControl

std::vector<std::pair<std::string, std::string>> getMiscControls()

Get the list of miscellaneous controls set by setControl

Returns:

A list of <key, value> pairs as strings

CameraControl &setControlMode(ControlMode mode)

Set a command to specify control mode

Parameters:

mode – Control mode

CameraControl &setHdr(bool enable)

Whether or not to enable HDR (High Dynamic Range) mode

Parameters:

enable – True to enable HDR mode, false to disable

CameraControl &setCaptureIntent(CaptureIntent mode)

Set a command to specify capture intent mode

Parameters:

mode – Capture intent mode

bool getCaptureStill() const

Check whether command to capture a still is set

Returns:

True if capture still command is set

std::chrono::microseconds getExposureTime() const

Retrieves exposure time

int getSensitivity() const

Retrieves sensitivity, as an ISO value

int getLensPosition() const

Retrieves lens position, range 0..255. Returns -1 if not available

bool getHdr() const

Whether or not HDR (High Dynamic Range) mode is enabled

Returns:

True if HDR mode is enabled, false otherwise

inline void setCommand(Command cmd, bool value = true)
inline void clearCommand(Command cmd)
inline bool getCommand(Command cmd) const
~CameraControl() override
virtual void serialize(std::vector<std::uint8_t> &metadata, DatatypeEnum &datatype) const override
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)
float getLensPositionRaw() const

Retrieves lens position, range 0.0f..1.0f.

Public Members

uint64_t cmdMask = 0
AutoFocusMode autoFocusMode = AutoFocusMode::CONTINUOUS_VIDEO
uint8_t lensPosition = 0

Lens/VCM position, range: 0..255. Used with autoFocusMode = OFF. With current IMX378 modules:

  • 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)

float lensPositionRaw = 0
uint8_t lensPosAutoInfinity
uint8_t lensPosAutoMacro
ManualExposureParams expManual
RegionParams aeRegion
RegionParams afRegion
AutoWhiteBalanceMode awbMode
SceneMode sceneMode
AntiBandingMode antiBandingMode
CaptureIntent captureIntent
ControlMode controlMode
EffectMode effectMode
FrameSyncMode frameSyncMode
StrobeConfig strobeConfig
StrobeTimings strobeTimings
uint32_t aeMaxExposureTimeUs
bool aeLockMode = {false}
bool awbLockMode = {false}
int8_t expCompensation
int8_t brightness
int8_t contrast
int8_t saturation
uint8_t sharpness
uint8_t lumaDenoise
uint8_t chromaDenoise
uint16_t wbColorTemp
uint8_t lowPowerNumFramesBurst
uint8_t lowPowerNumFramesDiscard
bool enableHdr = {false}
std::vector<std::pair<std::string, std::string>> miscControls
struct ManualExposureParams

Public Functions

DEPTHAI_SERIALIZE(ManualExposureParams, exposureTimeUs, sensitivityIso, frameDurationUs)

Public Members

uint32_t exposureTimeUs
uint32_t sensitivityIso
uint32_t frameDurationUs
struct RegionParams

Public Functions

DEPTHAI_SERIALIZE(RegionParams, x, y, width, height, priority)

Public Members

uint16_t x
uint16_t y
uint16_t width
uint16_t height
uint32_t priority
struct StrobeConfig

Public Functions

DEPTHAI_SERIALIZE(StrobeConfig, enable, activeLevel, gpioNumber)

Public Members

uint8_t enable

Enable strobe output.

uint8_t activeLevel

1 for normal polarity (high-active), 0 otherwise

int8_t gpioNumber

GPIO number to drive, or -1 if sensor driven.

struct StrobeTimings

Public Functions

DEPTHAI_SERIALIZE(StrobeTimings, exposureBeginOffsetUs, exposureEndOffsetUs, durationUs)

Public Members

int32_t exposureBeginOffsetUs

Start offset in microseconds, relative to exposure window.

int32_t exposureEndOffsetUs

End offset in microseconds, relative to exposure window.

uint32_t durationUs

Fixed duration in microseconds. If set (non-zero), overrides exposureEndOffsetUs