# CameraControl

This message is used for controlling the
[Camera](https://docs.luxonis.com/software-v3/depthai/depthai-components/nodes/camera.md). The message handles things like
capturing still images, configuring auto focus, anti banding, white balance, scenes, effects etc.

## Examples of functionality

 * [Auto Exposure on ROI](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_roi_exposure_focus.md)

## Reference

### dai::CameraControl

Kind: class

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

#### dai::CameraControl::ManualExposureParams

Kind: struct

##### uint32_t exposureTimeUs

Kind: variable

##### uint32_t sensitivityIso

Kind: variable

##### uint32_t frameDurationUs

Kind: variable

##### DEPTHAI_SERIALIZE(ManualExposureParams, exposureTimeUs, sensitivityIso, frameDurationUs)

Kind: function

#### dai::CameraControl::RegionParams

Kind: struct

##### uint16_t x

Kind: variable

##### uint16_t y

Kind: variable

##### uint16_t width

Kind: variable

##### uint16_t height

Kind: variable

##### uint32_t priority

Kind: variable

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

Kind: function

#### dai::CameraControl::StrobeConfig

Kind: struct

##### uint8_t enable

Kind: variable

Enable strobe output.

##### uint8_t activeLevel

Kind: variable

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

##### int8_t gpioNumber

Kind: variable

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

##### DEPTHAI_SERIALIZE(StrobeConfig, enable, activeLevel, gpioNumber)

Kind: function

#### dai::CameraControl::StrobeTimings

Kind: struct

##### int32_t exposureBeginOffsetUs

Kind: variable

Start offset in microseconds, relative to exposure window.

##### int32_t exposureEndOffsetUs

Kind: variable

End offset in microseconds, relative to exposure window.

##### uint32_t durationUs

Kind: variable

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

##### DEPTHAI_SERIALIZE(StrobeTimings, exposureBeginOffsetUs, exposureEndOffsetUs, durationUs)

Kind: function

#### uint8_t Command

Kind: enum

##### START_STREAM

Kind: enum_value

##### STOP_STREAM

Kind: enum_value

##### STILL_CAPTURE

Kind: enum_value

##### MOVE_LENS

Kind: enum_value

##### AF_TRIGGER

Kind: enum_value

##### AE_MANUAL

Kind: enum_value

##### AE_AUTO

Kind: enum_value

##### AWB_MODE

Kind: enum_value

##### SCENE_MODE

Kind: enum_value

##### ANTIBANDING_MODE

Kind: enum_value

##### EXPOSURE_COMPENSATION

Kind: enum_value

##### AE_LOCK

Kind: enum_value

##### AE_TARGET_FPS_RANGE

Kind: enum_value

##### AWB_LOCK

Kind: enum_value

##### CAPTURE_INTENT

Kind: enum_value

##### CONTROL_MODE

Kind: enum_value

##### FRAME_DURATION

Kind: enum_value

##### SENSITIVITY

Kind: enum_value

##### EFFECT_MODE

Kind: enum_value

##### AF_MODE

Kind: enum_value

##### NOISE_REDUCTION_STRENGTH

Kind: enum_value

##### SATURATION

Kind: enum_value

##### BRIGHTNESS

Kind: enum_value

##### STREAM_FORMAT

Kind: enum_value

##### RESOLUTION

Kind: enum_value

##### SHARPNESS

Kind: enum_value

##### CUSTOM_USECASE

Kind: enum_value

##### CUSTOM_CAPT_MODE

Kind: enum_value

##### CUSTOM_EXP_BRACKETS

Kind: enum_value

##### CUSTOM_CAPTURE

Kind: enum_value

##### CONTRAST

Kind: enum_value

##### AE_REGION

Kind: enum_value

##### AF_REGION

Kind: enum_value

##### LUMA_DENOISE

Kind: enum_value

##### CHROMA_DENOISE

Kind: enum_value

##### WB_COLOR_TEMP

Kind: enum_value

##### EXTERNAL_TRIGGER

Kind: enum_value

##### AF_LENS_RANGE

Kind: enum_value

##### FRAME_SYNC

Kind: enum_value

##### STROBE_CONFIG

Kind: enum_value

##### STROBE_TIMINGS

Kind: enum_value

##### MOVE_LENS_RAW

Kind: enum_value

##### HDR

Kind: enum_value

#### uint8_t AutoFocusMode

Kind: enum

##### OFF

Kind: enum_value

Autofocus disabled. Suitable for manual focus

##### AUTO

Kind: enum_value

Basic automatic focus mode. In this mode, the lens does not move unless the autofocus trigger action is called.

##### MACRO

Kind: enum_value

Close-up focusing mode - this mode is optimized for focusing on objects very close to the camera.

##### CONTINUOUS_VIDEO

Kind: enum_value

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.

##### CONTINUOUS_PICTURE

Kind: enum_value

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

##### EDOF

Kind: enum_value

Extended depth of field (digital focus) mode. The camera device will produce images with an extended depth of field automatically.
AF triggers are ignored.

#### uint8_t AutoWhiteBalanceMode

Kind: enum

##### OFF

Kind: enum_value

The camera device's auto-white balance routine is disabled.

##### AUTO

Kind: enum_value

The camera device's auto-white balance routine is active.

##### INCANDESCENT

Kind: enum_value

The camera device's auto-white balance routine is disabled; the camera device uses incandescent light as the assumed scene
illumination for white balance.

##### FLUORESCENT

Kind: enum_value

The camera device's auto-white balance routine is disabled; the camera device uses fluorescent light as the assumed scene
illumination for white balance.

##### WARM_FLUORESCENT

Kind: enum_value

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.

##### DAYLIGHT

Kind: enum_value

The camera device's auto-white balance routine is disabled; the camera device uses daylight light as the assumed scene
illumination for white balance.

##### CLOUDY_DAYLIGHT

Kind: enum_value

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.

##### TWILIGHT

Kind: enum_value

The camera device's auto-white balance routine is disabled; the camera device uses twilight light as the assumed scene
illumination for white balance.

##### SHADE

Kind: enum_value

The camera device's auto-white balance routine is disabled; the camera device uses shade light as the assumed scene illumination
for white balance.

#### uint8_t SceneMode

Kind: enum

##### UNSUPPORTED

Kind: enum_value

Indicates that no scene modes are set for a given capture request.

##### FACE_PRIORITY

Kind: enum_value

If face detection support exists, use face detection data for auto-focus, auto-white balance, and auto-exposure routines.

##### ACTION

Kind: enum_value

Optimized for photos of quickly moving objects. Similar to SPORTS scene mode.

##### PORTRAIT

Kind: enum_value

Optimized for still photos of people.

##### LANDSCAPE

Kind: enum_value

Optimized for photos of distant macroscopic objects.

##### NIGHT

Kind: enum_value

Optimized for low-light settings.

##### NIGHT_PORTRAIT

Kind: enum_value

Optimized for still photos of people in low-light settings.

##### THEATRE

Kind: enum_value

Optimized for dim, indoor settings where flash must remain off.

##### BEACH

Kind: enum_value

Optimized for bright, outdoor beach settings.

##### SNOW

Kind: enum_value

Optimized for bright, outdoor settings containing snow.

##### SUNSET

Kind: enum_value

Optimized for scenes of the setting sun.

##### STEADYPHOTO

Kind: enum_value

Optimized to avoid blurry photos due to small amounts of device motion (for example: due to hand shake).

##### FIREWORKS

Kind: enum_value

Optimized for nighttime photos of fireworks.

##### SPORTS

Kind: enum_value

Optimized for photos of quickly moving people.

##### PARTY

Kind: enum_value

Optimized for dim, indoor settings with multiple moving people.

##### CANDLELIGHT

Kind: enum_value

Optimized for dim settings where the main light source is a candle.

##### BARCODE

Kind: enum_value

Optimized for accurately capturing a photo of barcode for use by camera applications that wish to read the barcode value.

#### uint8_t AntiBandingMode

Kind: enum

##### OFF

Kind: enum_value

The camera device will not adjust exposure duration to avoid banding problems.

##### MAINS_50_HZ

Kind: enum_value

The camera device will adjust exposure duration to avoid banding problems with 50Hz illumination sources.

##### MAINS_60_HZ

Kind: enum_value

The camera device will adjust exposure duration to avoid banding problems with 60Hz illumination sources.

##### AUTO

Kind: enum_value

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.

#### uint8_t CaptureIntent

Kind: enum

##### CUSTOM

Kind: enum_value

The goal of this request doesn't fall into the other categories. The camera device will default to preview-like behavior.

##### PREVIEW

Kind: enum_value

This request is for a preview-like use case.

##### STILL_CAPTURE

Kind: enum_value

This request is for a still capture-type use case.

##### VIDEO_RECORD

Kind: enum_value

This request is for a video recording use case.

##### VIDEO_SNAPSHOT

Kind: enum_value

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.

##### ZERO_SHUTTER_LAG

Kind: enum_value

This request is for a ZSL usecase; the application will stream full-resolution images and reprocess one or several later for a
final capture.

#### uint8_t ControlMode

Kind: enum

##### OFF

Kind: enum_value

Full application control of pipeline. All control by the device's metering and focusing (3A) routines is disabled.

##### AUTO

Kind: enum_value

Use settings for each individual 3A routine. Manual control of capture parameters is disabled.

##### USE_SCENE_MODE

Kind: enum_value

Use a specific scene mode. Enabling this disables Auto-Exposure, AWB and AF controls;

#### uint8_t EffectMode

Kind: enum

##### OFF

Kind: enum_value

No color effect will be applied.

##### MONO

Kind: enum_value

A "monocolor" effect where the image is mapped into a single color. This will typically be grayscale.

##### NEGATIVE

Kind: enum_value

A "photo-negative" effect where the image's colors are inverted.

##### SOLARIZE

Kind: enum_value

A "solarisation" effect (Sabattier effect) where the image is wholly or partially reversed in tone.

##### SEPIA

Kind: enum_value

A "sepia" effect where the image is mapped into warm gray, red, and brown tones.

##### POSTERIZE

Kind: enum_value

A "posterization" effect where the image uses discrete regions of tone rather than a continuous gradient of tones.

##### WHITEBOARD

Kind: enum_value

A "whiteboard" effect where the image is typically displayed as regions of white, with black or grey details.

##### BLACKBOARD

Kind: enum_value

A "blackboard" effect where the image is typically displayed as regions of black, with white or grey details.

##### AQUA

Kind: enum_value

An "aqua" effect where a blue hue is added to the image.

#### int8_t FrameSyncMode

Kind: enum

##### AUTO

Kind: enum_value

##### OFF

Kind: enum_value

##### OUTPUT

Kind: enum_value

##### INPUT

Kind: enum_value

##### TIME_PTP

Kind: enum_value

#### uint64_t cmdMask

Kind: variable

#### AutoFocusMode autoFocusMode

Kind: variable

#### uint8_t lensPosition

Kind: variable

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)

#### float lensPositionRaw

Kind: variable

#### uint8_t lensPosAutoInfinity

Kind: variable

#### uint8_t lensPosAutoMacro

Kind: variable

#### ManualExposureParams expManual

Kind: variable

#### RegionParams aeRegion

Kind: variable

#### RegionParams afRegion

Kind: variable

#### AutoWhiteBalanceMode awbMode

Kind: variable

#### SceneMode sceneMode

Kind: variable

#### AntiBandingMode antiBandingMode

Kind: variable

#### CaptureIntent captureIntent

Kind: variable

#### ControlMode controlMode

Kind: variable

#### EffectMode effectMode

Kind: variable

#### FrameSyncMode frameSyncMode

Kind: variable

#### StrobeConfig strobeConfig

Kind: variable

#### StrobeTimings strobeTimings

Kind: variable

#### uint32_t aeMaxExposureTimeUs

Kind: variable

#### bool aeLockMode

Kind: variable

#### bool awbLockMode

Kind: variable

#### int8_t expCompensation

Kind: variable

#### int8_t brightness

Kind: variable

#### int8_t contrast

Kind: variable

#### int8_t saturation

Kind: variable

#### uint8_t sharpness

Kind: variable

#### uint8_t lumaDenoise

Kind: variable

#### uint8_t chromaDenoise

Kind: variable

#### uint16_t wbColorTemp

Kind: variable

#### uint8_t lowPowerNumFramesBurst

Kind: variable

#### uint8_t lowPowerNumFramesDiscard

Kind: variable

#### bool enableHdr

Kind: variable

#### std::vector< std::pair< std::string, std::string > > miscControls

Kind: variable

#### CameraControl()

Kind: function

#### CameraControl & setCaptureStill(bool capture)

Kind: function

Set a command to capture a still image

#### CameraControl & setStartStreaming()

Kind: function

Set a command to start streaming

#### CameraControl & setStopStreaming()

Kind: function

Set a command to stop streaming

#### CameraControl & setExternalTrigger(int numFramesBurst, int numFramesDiscard)

Kind: function

Set a command to enable external trigger snapshot mode A rising edge on the sensor FSIN pin will make it capture a sequence of

#### CameraControl & setFrameSyncMode(FrameSyncMode mode)

Kind: function

Set the frame sync mode for continuous streaming operation mode, translating to how the camera pin FSIN/FSYNC is used:
auto/input/output/disabled

#### CameraControl & setStrobeSensor(int activeLevel)

Kind: function

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)

Kind: function

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

Kind: function

Disable STROBE output

#### CameraControl & setAutoFocusMode(AutoFocusMode mode)

Kind: function

Set a command to specify autofocus mode. Default

#### CameraControl & setAutoFocusTrigger()

Kind: function

Set a command to trigger autofocus

#### CameraControl & setAutoFocusLensRange(int infinityPosition, int macroPosition)

Kind: function

Set autofocus lens range,

#### CameraControl & setAutoFocusRegion(uint16_t startX, uint16_t startY, uint16_t width, uint16_t height)

Kind: function

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)

Kind: function

Set a command to specify manual focus position parameters: lensPosition: specify lens position 0..255

#### CameraControl & setManualFocusRaw(float lensPositionRaw)

Kind: function

Set a command to specify manual focus position (more precise control). parameters: lensPositionRaw: specify lens position 0.0f ..
1.0f return: CameraControl &

#### CameraControl & setAutoExposureEnable()

Kind: function

Set a command to enable auto exposure

#### CameraControl & setAutoExposureLock(bool lock)

Kind: function

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)

Kind: function

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)

Kind: function

Set a command to specify auto exposure compensation. This modifies the brightness target with positive numbers 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)

Kind: function

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)

Kind: function

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)

Kind: function

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:

#### CameraControl & setManualExposure(uint32_t exposureTimeUs, uint32_t sensitivityIso)

Kind: function

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)

Kind: function

Set a command to manually specify exposure parameters: exposureTime: Exposure time; sensitivityIso: Sensitivity as ISO value,
usual range 100..1600

#### CameraControl & setAutoWhiteBalanceMode(AutoWhiteBalanceMode mode)

Kind: function

Set a command to specify auto white balance mode parameters: mode: Auto white balance mode to use. Default

#### CameraControl & setAutoWhiteBalanceLock(bool lock)

Kind: function

Set a command to specify auto white balance lock parameters: lock: Auto white balance lock mode enabled or disabled

#### CameraControl & setManualWhiteBalance(int colorTemperatureK)

Kind: function

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)

Kind: function

Set a command to adjust image brightness parameters: value: Brightness, range -10..10, default 0

#### CameraControl & setContrast(int value)

Kind: function

Set a command to adjust image contrast parameters: value: Contrast, range -10..10, default 0

#### CameraControl & setSaturation(int value)

Kind: function

Set a command to adjust image saturation parameters: value: Saturation, range -10..10, default 0

#### CameraControl & setSharpness(int value)

Kind: function

Set a command to adjust image sharpness parameters: value: Sharpness, range 0..4, default 1

#### CameraControl & setLumaDenoise(int value)

Kind: function

Set a command to adjust luma denoise amount parameters: value: Luma denoise amount, range 0..4, default 1

#### CameraControl & setChromaDenoise(int value)

Kind: function

Set a command to adjust chroma denoise amount parameters: value: Chroma denoise amount, range 0..4, default 1

#### CameraControl & setSceneMode(SceneMode mode)

Kind: function

Set a command to specify scene mode parameters: mode: Scene mode

#### CameraControl & setEffectMode(EffectMode mode)

Kind: function

Set a command to specify effect mode parameters: mode: Effect mode

#### CameraControl & setMisc(std::string control, std::string value)

Kind: function

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)

Kind: function

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)

Kind: function

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

Kind: function

Clear the list of miscellaneous controls set by

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

Kind: function

Get the list of miscellaneous controls set by return: A list of <key, value> pairs as strings

#### CameraControl & setControlMode(ControlMode mode)

Kind: function

Set a command to specify control mode parameters: mode: Control mode

#### CameraControl & setHdr(bool enable)

Kind: function

Whether or not to enable HDR (High Dynamic Range) mode parameters: enable: True to enable HDR mode, false to disable

#### CameraControl & setCaptureIntent(CaptureIntent mode)

Kind: function

Set a command to specify capture intent mode parameters: mode: Capture intent mode

#### bool getCaptureStill()

Kind: function

Check whether command to capture a still is set return: True if capture still command is set

#### std::chrono::microseconds getExposureTime()

Kind: function

Retrieves exposure time

#### int getSensitivity()

Kind: function

Retrieves sensitivity, as an ISO value

#### int getLensPosition()

Kind: function

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

#### bool getHdr()

Kind: function

Whether or not HDR (High Dynamic Range) mode is enabled return: True if HDR mode is enabled, false otherwise

#### void setCommand(Command cmd, bool value)

Kind: function

#### void clearCommand(Command cmd)

Kind: function

#### bool getCommand(Command cmd)

Kind: function

#### ~CameraControl()

Kind: function

#### void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)

Kind: function

#### DatatypeEnum getDatatype()

Kind: function

Get the datatype of this specific message.

return: DatatypeEnum

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

Kind: function

#### float getLensPositionRaw()

Kind: function

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

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
