CameraControl¶
This message is used for controlling the color camera as well as the mono camera. The message handles things like capturing still images, configuring auto focus, anti banding, white balance, scenes, effects etc.
Examples of functionality¶
Reference¶
-
class
depthai.
CameraControl
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.
-
class
AntiBandingMode
Members:
OFF
MAINS_50_HZ
MAINS_60_HZ
AUTO
-
property
name
-
property
-
class
AutoFocusMode
Members:
OFF
AUTO
MACRO
CONTINUOUS_VIDEO
CONTINUOUS_PICTURE
EDOF
-
property
name
-
property
-
class
AutoWhiteBalanceMode
Members:
OFF
AUTO
INCANDESCENT
FLUORESCENT
WARM_FLUORESCENT
DAYLIGHT
CLOUDY_DAYLIGHT
TWILIGHT
SHADE
-
property
name
-
property
-
class
Command
Members:
START_STREAM
STOP_STREAM
STILL_CAPTURE
MOVE_LENS
AF_TRIGGER
AE_MANUAL
AE_AUTO
AWB_MODE
SCENE_MODE
ANTIBANDING_MODE
EXPOSURE_COMPENSATION
AE_LOCK
AE_TARGET_FPS_RANGE
AWB_LOCK
CAPTURE_INTENT
CONTROL_MODE
FRAME_DURATION
SENSITIVITY
EFFECT_MODE
AF_MODE
NOISE_REDUCTION_STRENGTH
SATURATION
BRIGHTNESS
STREAM_FORMAT
RESOLUTION
SHARPNESS
CUSTOM_USECASE
CUSTOM_CAPT_MODE
CUSTOM_EXP_BRACKETS
CUSTOM_CAPTURE
CONTRAST
AE_REGION
AF_REGION
LUMA_DENOISE
CHROMA_DENOISE
WB_COLOR_TEMP
-
property
name
-
property
-
class
EffectMode
Members:
OFF
MONO
NEGATIVE
SOLARIZE
SEPIA
POSTERIZE
WHITEBOARD
BLACKBOARD
AQUA
-
property
name
-
property
-
class
FrameSyncMode
Members:
OFF
OUTPUT
INPUT
-
property
name
-
property
-
class
SceneMode
Members:
UNSUPPORTED
FACE_PRIORITY
ACTION
PORTRAIT
LANDSCAPE
NIGHT
NIGHT_PORTRAIT
THEATRE
BEACH
SNOW
SUNSET
STEADYPHOTO
FIREWORKS
SPORTS
PARTY
CANDLELIGHT
BARCODE
-
property
name
-
property
-
get
(self: depthai.CameraControl) → depthai.RawCameraControl Retrieve configuration data for CameraControl.
- Returns
config for CameraControl
-
getCaptureStill
(self: depthai.CameraControl) → bool Check whether command to capture a still is set
- Returns
True if capture still command is set
-
getData
(self: object) → numpy.ndarray[numpy.uint8] Get non-owning reference to internal buffer
- Returns
Reference to internal buffer
-
getExposureTime
(self: depthai.CameraControl) → datetime.timedelta Retrieves exposure time
-
getLensPosition
(self: depthai.CameraControl) → int Retrieves lens position, range 0..255. Returns -1 if not available
-
getRaw
(self: depthai.ADatatype) → depthai.RawBuffer
-
getSensitivity
(self: depthai.CameraControl) → int Retrieves sensitivity, as an ISO value
-
getSequenceNum
(self: depthai.Buffer) → int Retrieves sequence number
-
getTimestamp
(self: depthai.Buffer) → datetime.timedelta Retrieves timestamp related to dai::Clock::now()
-
getTimestampDevice
(self: depthai.Buffer) → datetime.timedelta Retrieves timestamp directly captured from device’s monotonic clock, not synchronized to host time. Used mostly for debugging
-
set
(self: depthai.CameraControl, config: depthai.RawCameraControl) → depthai.CameraControl Set explicit configuration.
- Parameter
config
: Explicit configuration
- Parameter
-
setAntiBandingMode
(self: depthai.CameraControl, mode: depthai.RawCameraControl.AntiBandingMode) → depthai.CameraControl 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.
- Parameter
mode
: Anti-banding mode to use. Default: MAINS_50_HZ
- Parameter
-
setAutoExposureCompensation
(self: depthai.CameraControl, compensation: int) → depthai.CameraControl Set a command to specify auto exposure compensation
- Parameter
compensation
: Compensation value between -9..9, default 0
- Parameter
-
setAutoExposureEnable
(self: depthai.CameraControl) → depthai.CameraControl Set a command to enable auto exposure
-
setAutoExposureLock
(self: depthai.CameraControl, lock: bool) → depthai.CameraControl Set a command to specify lock auto exposure
- Parameter
lock
: Auto exposure lock mode enabled or disabled
- Parameter
-
setAutoExposureRegion
(self: depthai.CameraControl, startX: int, startY: int, width: int, height: int) → depthai.CameraControl Set a command to specify auto exposure region in pixels. Note: the region should be mapped to the configured sensor resolution, before ISP scaling
- Parameter
startX
: X coordinate of top left corner of region
- Parameter
startY
: Y coordinate of top left corner of region
- Parameter
width
: Region width
- Parameter
height
: Region height
- Parameter
-
setAutoFocusLensRange
(self: depthai.CameraControl, infinityPosition: int, macroPosition: int) → depthai.CameraControl Set autofocus lens range, infinityPosition < macroPosition, valid values 0..255. May help to improve autofocus in case the lens adjustment is not typical/tuned
-
setAutoFocusMode
(self: depthai.CameraControl, mode: depthai.RawCameraControl.AutoFocusMode) → depthai.CameraControl Set a command to specify autofocus mode. Default CONTINUOUS_VIDEO
-
setAutoFocusRegion
(self: depthai.CameraControl, startX: int, startY: int, width: int, height: int) → depthai.CameraControl Set a command to specify focus region in pixels. Note: the region should be mapped to the configured sensor resolution, before ISP scaling
- Parameter
startX
: X coordinate of top left corner of region
- Parameter
startY
: Y coordinate of top left corner of region
- Parameter
width
: Region width
- Parameter
height
: Region height
- Parameter
-
setAutoFocusTrigger
(self: depthai.CameraControl) → depthai.CameraControl Set a command to trigger autofocus
-
setAutoWhiteBalanceLock
(self: depthai.CameraControl, lock: bool) → depthai.CameraControl Set a command to specify auto white balance lock
- Parameter
lock
: Auto white balance lock mode enabled or disabled
- Parameter
-
setAutoWhiteBalanceMode
(self: depthai.CameraControl, mode: depthai.RawCameraControl.AutoWhiteBalanceMode) → depthai.CameraControl Set a command to specify auto white balance mode
- Parameter
mode
: Auto white balance mode to use. Default AUTO
- Parameter
-
setBrightness
(self: depthai.CameraControl, value: int) → depthai.CameraControl Set a command to adjust image brightness
- Parameter
value
: Brightness, range -10..10, default 0
- Parameter
-
setCaptureStill
(self: depthai.CameraControl, capture: bool) → depthai.CameraControl Set a command to capture a still image
-
setChromaDenoise
(self: depthai.CameraControl, value: int) → depthai.CameraControl Set a command to adjust chroma denoise amount
- Parameter
value
: Chroma denoise amount, range 0..4, default 1
- Parameter
-
setContrast
(self: depthai.CameraControl, value: int) → depthai.CameraControl Set a command to adjust image contrast
- Parameter
value
: Contrast, range -10..10, default 0
- Parameter
-
setData
(*args, **kwargs) Overloaded function.
setData(self: depthai.Buffer, arg0: List[int]) -> None
- Parameter
data
: Copies data to internal buffer
setData(self: depthai.Buffer, arg0: numpy.ndarray[numpy.uint8]) -> None
- Parameter
data
: Copies data to internal buffer
-
setEffectMode
(self: depthai.CameraControl, mode: depthai.RawCameraControl.EffectMode) → depthai.CameraControl Set a command to specify effect mode
- Parameter
mode
: Effect mode
- Parameter
-
setExternalTrigger
(self: depthai.CameraControl, numFramesBurst: int, numFramesDiscard: int) → depthai.CameraControl 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
-
setFrameSyncMode
(self: depthai.CameraControl, mode: depthai.RawCameraControl.FrameSyncMode) → depthai.CameraControl Set the frame sync mode for continuous streaming operation mode, translating to how the camera pin FSIN/FSYNC is used: input/output/disabled
-
setLumaDenoise
(self: depthai.CameraControl, value: int) → depthai.CameraControl Set a command to adjust luma denoise amount
- Parameter
value
: Luma denoise amount, range 0..4, default 1
- Parameter
-
setManualExposure
(*args, **kwargs) Overloaded function.
setManualExposure(self: depthai.CameraControl, exposureTimeUs: int, sensitivityIso: int) -> depthai.CameraControl
Set a command to manually specify exposure
- Parameter
exposureTimeUs
: Exposure time in microseconds
- Parameter
sensitivityIso
: Sensitivity as ISO value, usual range 100..1600
setManualExposure(self: depthai.CameraControl, exposureTime: datetime.timedelta, sensitivityIso: int) -> None
Set a command to manually specify exposure
- Parameter
exposureTime
: Exposure time
- Parameter
sensitivityIso
: Sensitivity as ISO value, usual range 100..1600
-
setManualFocus
(self: depthai.CameraControl, lensPosition: int) → depthai.CameraControl Set a command to specify manual focus position
- Parameter
lensPosition
: specify lens position 0..255
- Parameter
-
setManualWhiteBalance
(self: depthai.CameraControl, colorTemperatureK: int) → depthai.CameraControl Set a command to manually specify white-balance color correction
- Parameter
colorTemperatureK
: Light source color temperature in kelvins, range 1000..12000
- Parameter
-
setSaturation
(self: depthai.CameraControl, value: int) → depthai.CameraControl Set a command to adjust image saturation
- Parameter
value
: Saturation, range -10..10, default 0
- Parameter
-
setSceneMode
(self: depthai.CameraControl, mode: depthai.RawCameraControl.SceneMode) → depthai.CameraControl Set a command to specify scene mode
- Parameter
mode
: Scene mode
- Parameter
-
setSequenceNum
(self: depthai.Buffer, arg0: int) → depthai.Buffer Retrieves sequence number
-
setSharpness
(self: depthai.CameraControl, value: int) → depthai.CameraControl Set a command to adjust image sharpness
- Parameter
value
: Sharpness, range 0..4, default 1
- Parameter
-
setStartStreaming
(self: depthai.CameraControl) → depthai.CameraControl Set a command to start streaming
-
setStopStreaming
(self: depthai.CameraControl) → depthai.CameraControl Set a command to stop streaming
-
setStrobeDisable
(self: depthai.CameraControl) → depthai.CameraControl Disable STROBE output
-
setStrobeExternal
(self: depthai.CameraControl, gpioNumber: int, activeLevel: int) → depthai.CameraControl 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
-
setStrobeSensor
(self: depthai.CameraControl, activeLevel: int) → depthai.CameraControl Enable STROBE output on sensor pin, optionally configuring the polarity. Note: for many sensors the polarity is high-active and not configurable
-
setTimestamp
(self: depthai.Buffer, arg0: datetime.timedelta) → depthai.Buffer Sets timestamp related to dai::Clock::now()
-
setTimestampDevice
(self: depthai.Buffer, arg0: datetime.timedelta) → depthai.Buffer Sets timestamp related to dai::Clock::now()
-
class
dai
::
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 inAUTO
mode, and auto-exposure with anti-banding for 50Hz mains frequency.Public Types
-
using
AutoFocusMode
= RawCameraControl::AutoFocusMode¶
-
using
AntiBandingMode
= RawCameraControl::AntiBandingMode¶
-
using
AutoWhiteBalanceMode
= RawCameraControl::AutoWhiteBalanceMode¶
-
using
SceneMode
= RawCameraControl::SceneMode¶
-
using
EffectMode
= RawCameraControl::EffectMode¶
-
using
FrameSyncMode
= RawCameraControl::FrameSyncMode¶
Public Functions
-
CameraControl
()¶ Construct CameraControl message.
-
~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. FirstnumFramesDiscard
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 values0..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 regionstartY
: Y coordinate of top left corner of regionwidth
: Region widthheight
: Region height
-
CameraControl &
setManualFocus
(uint8_t lensPosition)¶ Set a command to specify manual focus position
- Parameters
lensPosition
: specify lens position 0..255
-
CameraControl &
setAutoExposureEnable
()¶ Set a command to enable auto exposure
-
CameraControl &
setAutoExposureLock
(bool lock)¶ Set a command to specify lock auto exposure
- 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 regionstartY
: Y coordinate of top left corner of regionwidth
: Region widthheight
: Region height
-
CameraControl &
setAutoExposureCompensation
(int compensation)¶ Set a command to specify auto exposure compensation
- Parameters
compensation
: Compensation value between -9..9, default 0
-
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 microsecondssensitivityIso
: Sensitivity as ISO value, usual range 100..1600
-
void
setManualExposure
(std::chrono::microseconds exposureTime, uint32_t sensitivityIso)¶ Set a command to manually specify exposure
- Parameters
exposureTime
: Exposure timesensitivityIso
: 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. DefaultAUTO
-
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
-
bool
getCaptureStill
() const¶ Check whether command to capture a still is set
- Return
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
-
CameraControl &
set
(dai::RawCameraControl config)¶ Set explicit configuration.
- Parameters
config
: Explicit configuration
-
dai::RawCameraControl
get
() const¶ Retrieve configuration data for CameraControl.
- Return
config for CameraControl
Private Members
-
RawCameraControl &
cfg
¶