Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
dai::CameraControl Class Reference

#include <CameraControl.hpp>

Inheritance diagram for dai::CameraControl:
Inheritance graph
[legend]

Public Types

using AntiBandingMode = RawCameraControl::AntiBandingMode
 
using AutoFocusMode = RawCameraControl::AutoFocusMode
 
using AutoWhiteBalanceMode = RawCameraControl::AutoWhiteBalanceMode
 
using CaptureIntent = RawCameraControl::CaptureIntent
 
using ControlMode = RawCameraControl::ControlMode
 
using EffectMode = RawCameraControl::EffectMode
 
using FrameSyncMode = RawCameraControl::FrameSyncMode
 
using SceneMode = RawCameraControl::SceneMode
 

Public Member Functions

 CameraControl ()
 Construct CameraControl message. More...
 
 CameraControl (std::shared_ptr< RawCameraControl > ptr)
 
void clearMiscControls ()
 
dai::RawCameraControl get () const
 
bool getCaptureStill () const
 
std::chrono::microseconds getExposureTime () const
 
int getLensPosition () const
 
float getLensPositionRaw () const
 
std::vector< std::pair< std::string, std::string > > getMiscControls ()
 
int getSensitivity () const
 
CameraControlset (dai::RawCameraControl config)
 
CameraControlsetAntiBandingMode (AntiBandingMode mode)
 
CameraControlsetAutoExposureCompensation (int compensation)
 
CameraControlsetAutoExposureEnable ()
 
CameraControlsetAutoExposureLimit (std::chrono::microseconds maxExposureTime)
 
CameraControlsetAutoExposureLimit (uint32_t maxExposureTimeUs)
 
CameraControlsetAutoExposureLock (bool lock)
 
CameraControlsetAutoExposureRegion (uint16_t startX, uint16_t startY, uint16_t width, uint16_t height)
 
CameraControlsetAutoFocusLensRange (int infinityPosition, int macroPosition)
 
CameraControlsetAutoFocusMode (AutoFocusMode mode)
 
CameraControlsetAutoFocusRegion (uint16_t startX, uint16_t startY, uint16_t width, uint16_t height)
 
CameraControlsetAutoFocusTrigger ()
 
CameraControlsetAutoWhiteBalanceLock (bool lock)
 
CameraControlsetAutoWhiteBalanceMode (AutoWhiteBalanceMode mode)
 
CameraControlsetBrightness (int value)
 
CameraControlsetCaptureIntent (CaptureIntent mode)
 
CameraControlsetCaptureStill (bool capture)
 
CameraControlsetChromaDenoise (int value)
 
CameraControlsetContrast (int value)
 
CameraControlsetControlMode (ControlMode mode)
 
CameraControlsetEffectMode (EffectMode mode)
 
CameraControlsetExternalTrigger (int numFramesBurst, int numFramesDiscard)
 
CameraControlsetFrameSyncMode (FrameSyncMode mode)
 
CameraControlsetLumaDenoise (int value)
 
CameraControlsetManualExposure (std::chrono::microseconds exposureTime, uint32_t sensitivityIso)
 
CameraControlsetManualExposure (uint32_t exposureTimeUs, uint32_t sensitivityIso)
 
CameraControlsetManualFocus (uint8_t lensPosition)
 
CameraControlsetManualFocusRaw (float lensPositionRaw)
 
CameraControlsetManualWhiteBalance (int colorTemperatureK)
 
CameraControlsetMisc (std::string control, float value)
 
CameraControlsetMisc (std::string control, int value)
 
CameraControlsetMisc (std::string control, std::string value)
 
CameraControlsetSaturation (int value)
 
CameraControlsetSceneMode (SceneMode mode)
 
CameraControlsetSharpness (int value)
 
CameraControlsetStartStreaming ()
 
CameraControlsetStopStreaming ()
 
CameraControlsetStrobeDisable ()
 
CameraControlsetStrobeExternal (int gpioNumber, int activeLevel=1)
 
CameraControlsetStrobeSensor (int activeLevel=1)
 
virtual ~CameraControl ()=default
 
- Public Member Functions inherited from dai::Buffer
 Buffer ()
 Creates Buffer message. More...
 
 Buffer (std::shared_ptr< dai::RawBuffer > ptr)
 
std::vector< std::uint8_t > & getData () const
 Get non-owning reference to internal buffer. More...
 
int64_t getSequenceNum () const
 
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestamp () const
 
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestampDevice () const
 
void setData (const std::vector< std::uint8_t > &data)
 
void setData (std::vector< std::uint8_t > &&data)
 
BuffersetSequenceNum (int64_t sequenceNum)
 
BuffersetTimestamp (std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > timestamp)
 
BuffersetTimestampDevice (std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > timestamp)
 
virtual ~Buffer ()=default
 
- Public Member Functions inherited from dai::ADatatype
 ADatatype (std::shared_ptr< RawBuffer > r)
 
std::shared_ptr< RawBuffergetRaw () const
 
virtual ~ADatatype ()=default
 

Private Member Functions

std::shared_ptr< RawBufferserialize () const override
 

Private Attributes

RawCameraControlcfg
 

Additional Inherited Members

- Protected Attributes inherited from dai::ADatatype
std::shared_ptr< RawBufferraw
 

Detailed Description

CameraControl message. Specifies various camera control commands like:

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.

Definition at line 33 of file CameraControl.hpp.

Member Typedef Documentation

◆ AntiBandingMode

Definition at line 39 of file CameraControl.hpp.

◆ AutoFocusMode

Definition at line 38 of file CameraControl.hpp.

◆ AutoWhiteBalanceMode

Definition at line 40 of file CameraControl.hpp.

◆ CaptureIntent

Definition at line 44 of file CameraControl.hpp.

◆ ControlMode

Definition at line 43 of file CameraControl.hpp.

◆ EffectMode

Definition at line 42 of file CameraControl.hpp.

◆ FrameSyncMode

Definition at line 45 of file CameraControl.hpp.

◆ SceneMode

Definition at line 41 of file CameraControl.hpp.

Constructor & Destructor Documentation

◆ CameraControl() [1/2]

dai::CameraControl::CameraControl ( )

Construct CameraControl message.

Definition at line 9 of file CameraControl.cpp.

◆ CameraControl() [2/2]

dai::CameraControl::CameraControl ( std::shared_ptr< RawCameraControl ptr)
explicit

Definition at line 10 of file CameraControl.cpp.

◆ ~CameraControl()

virtual dai::CameraControl::~CameraControl ( )
virtualdefault

Member Function Documentation

◆ clearMiscControls()

void dai::CameraControl::clearMiscControls ( )

Clear the list of miscellaneous controls set by setControl

Definition at line 228 of file CameraControl.cpp.

◆ get()

dai::RawCameraControl dai::CameraControl::get ( ) const

Retrieve configuration data for CameraControl.

Returns
config for CameraControl

Definition at line 255 of file CameraControl.cpp.

◆ getCaptureStill()

bool dai::CameraControl::getCaptureStill ( ) const

Check whether command to capture a still is set

Returns
True if capture still command is set

Definition at line 235 of file CameraControl.cpp.

◆ getExposureTime()

std::chrono::microseconds dai::CameraControl::getExposureTime ( ) const

Retrieves exposure time

Definition at line 239 of file CameraControl.cpp.

◆ getLensPosition()

int dai::CameraControl::getLensPosition ( ) const

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

Definition at line 247 of file CameraControl.cpp.

◆ getLensPositionRaw()

float dai::CameraControl::getLensPositionRaw ( ) const

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

Definition at line 251 of file CameraControl.cpp.

◆ getMiscControls()

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

Get the list of miscellaneous controls set by setControl

Returns
A list of <key, value> pairs as strings

Definition at line 231 of file CameraControl.cpp.

◆ getSensitivity()

int dai::CameraControl::getSensitivity ( ) const

Retrieves sensitivity, as an ISO value

Definition at line 243 of file CameraControl.cpp.

◆ serialize()

std::shared_ptr< RawBuffer > dai::CameraControl::serialize ( ) const
overrideprivatevirtual

Reimplemented from dai::Buffer.

Definition at line 5 of file CameraControl.cpp.

◆ set()

CameraControl & dai::CameraControl::set ( dai::RawCameraControl  config)

Set explicit configuration.

Parameters
configExplicit configuration

Definition at line 259 of file CameraControl.cpp.

◆ setAntiBandingMode()

CameraControl & dai::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
modeAnti-banding mode to use. Default: MAINS_50_HZ

Definition at line 132 of file CameraControl.cpp.

◆ setAutoExposureCompensation()

CameraControl & dai::CameraControl::setAutoExposureCompensation ( int  compensation)

Set a command to specify auto exposure compensation

Parameters
compensationCompensation value between -9..9, default 0

Definition at line 119 of file CameraControl.cpp.

◆ setAutoExposureEnable()

CameraControl & dai::CameraControl::setAutoExposureEnable ( )

Set a command to enable auto exposure

Definition at line 101 of file CameraControl.cpp.

◆ setAutoExposureLimit() [1/2]

CameraControl & dai::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
maxExposureTimeMaximum exposure time

Definition at line 129 of file CameraControl.cpp.

◆ setAutoExposureLimit() [2/2]

CameraControl & dai::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
maxExposureTimeUsMaximum exposure time in microseconds

Definition at line 124 of file CameraControl.cpp.

◆ setAutoExposureLock()

CameraControl & dai::CameraControl::setAutoExposureLock ( bool  lock)

Set a command to specify lock auto exposure

Parameters
lockAuto exposure lock mode enabled or disabled

Definition at line 105 of file CameraControl.cpp.

◆ setAutoExposureRegion()

CameraControl & dai::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
startXX coordinate of top left corner of region
startYY coordinate of top left corner of region
widthRegion width
heightRegion height

Definition at line 110 of file CameraControl.cpp.

◆ setAutoFocusLensRange()

CameraControl & dai::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

Definition at line 73 of file CameraControl.cpp.

◆ setAutoFocusMode()

CameraControl & dai::CameraControl::setAutoFocusMode ( AutoFocusMode  mode)

Set a command to specify autofocus mode. Default CONTINUOUS_VIDEO

Definition at line 64 of file CameraControl.cpp.

◆ setAutoFocusRegion()

CameraControl & dai::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
startXX coordinate of top left corner of region
startYY coordinate of top left corner of region
widthRegion width
heightRegion height

Definition at line 79 of file CameraControl.cpp.

◆ setAutoFocusTrigger()

CameraControl & dai::CameraControl::setAutoFocusTrigger ( )

Set a command to trigger autofocus

Definition at line 69 of file CameraControl.cpp.

◆ setAutoWhiteBalanceLock()

CameraControl & dai::CameraControl::setAutoWhiteBalanceLock ( bool  lock)

Set a command to specify auto white balance lock

Parameters
lockAuto white balance lock mode enabled or disabled

Definition at line 155 of file CameraControl.cpp.

◆ setAutoWhiteBalanceMode()

CameraControl & dai::CameraControl::setAutoWhiteBalanceMode ( AutoWhiteBalanceMode  mode)

Set a command to specify auto white balance mode

Parameters
modeAuto white balance mode to use. Default AUTO

Definition at line 150 of file CameraControl.cpp.

◆ setBrightness()

CameraControl & dai::CameraControl::setBrightness ( int  value)

Set a command to adjust image brightness

Parameters
valueBrightness, range -10..10, default 0

Definition at line 167 of file CameraControl.cpp.

◆ setCaptureIntent()

CameraControl & dai::CameraControl::setCaptureIntent ( CaptureIntent  mode)

Set a command to specify capture intent mode

Parameters
modeCapture intent mode

Definition at line 212 of file CameraControl.cpp.

◆ setCaptureStill()

CameraControl & dai::CameraControl::setCaptureStill ( bool  capture)

Set a command to capture a still image

Definition at line 14 of file CameraControl.cpp.

◆ setChromaDenoise()

CameraControl & dai::CameraControl::setChromaDenoise ( int  value)

Set a command to adjust chroma denoise amount

Parameters
valueChroma denoise amount, range 0..4, default 1

Definition at line 192 of file CameraControl.cpp.

◆ setContrast()

CameraControl & dai::CameraControl::setContrast ( int  value)

Set a command to adjust image contrast

Parameters
valueContrast, range -10..10, default 0

Definition at line 172 of file CameraControl.cpp.

◆ setControlMode()

CameraControl & dai::CameraControl::setControlMode ( ControlMode  mode)

Set a command to specify control mode

Parameters
modeControl mode

Definition at line 207 of file CameraControl.cpp.

◆ setEffectMode()

CameraControl & dai::CameraControl::setEffectMode ( EffectMode  mode)

Set a command to specify effect mode

Parameters
modeEffect mode

Definition at line 202 of file CameraControl.cpp.

◆ setExternalTrigger()

CameraControl & dai::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

Definition at line 28 of file CameraControl.cpp.

◆ setFrameSyncMode()

CameraControl & dai::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

Definition at line 35 of file CameraControl.cpp.

◆ setLumaDenoise()

CameraControl & dai::CameraControl::setLumaDenoise ( int  value)

Set a command to adjust luma denoise amount

Parameters
valueLuma denoise amount, range 0..4, default 1

Definition at line 187 of file CameraControl.cpp.

◆ setManualExposure() [1/2]

CameraControl & dai::CameraControl::setManualExposure ( std::chrono::microseconds  exposureTime,
uint32_t  sensitivityIso 
)

Set a command to manually specify exposure

Parameters
exposureTimeExposure time
sensitivityIsoSensitivity as ISO value, usual range 100..1600

Definition at line 145 of file CameraControl.cpp.

◆ setManualExposure() [2/2]

CameraControl & dai::CameraControl::setManualExposure ( uint32_t  exposureTimeUs,
uint32_t  sensitivityIso 
)

Set a command to manually specify exposure

Parameters
exposureTimeUsExposure time in microseconds
sensitivityIsoSensitivity as ISO value, usual range 100..1600

Definition at line 137 of file CameraControl.cpp.

◆ setManualFocus()

CameraControl & dai::CameraControl::setManualFocus ( uint8_t  lensPosition)

Set a command to specify manual focus position

Parameters
lensPositionspecify lens position 0..255

Definition at line 88 of file CameraControl.cpp.

◆ setManualFocusRaw()

CameraControl & dai::CameraControl::setManualFocusRaw ( float  lensPositionRaw)

Set a command to specify manual focus position (more precise control).

Parameters
lensPositionRawspecify lens position 0.0f .. 1.0f
Returns
CameraControl&

Definition at line 94 of file CameraControl.cpp.

◆ setManualWhiteBalance()

CameraControl & dai::CameraControl::setManualWhiteBalance ( int  colorTemperatureK)

Set a command to manually specify white-balance color correction

Parameters
colorTemperatureKLight source color temperature in kelvins, range 1000..12000

Definition at line 160 of file CameraControl.cpp.

◆ setMisc() [1/3]

CameraControl & dai::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
controlControl name
valueValue as a floating point number

Definition at line 225 of file CameraControl.cpp.

◆ setMisc() [2/3]

CameraControl & dai::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
controlControl name
valueValue as an integer number

Definition at line 222 of file CameraControl.cpp.

◆ setMisc() [3/3]

CameraControl & dai::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
controlControl name
valueValue as a string

Definition at line 218 of file CameraControl.cpp.

◆ setSaturation()

CameraControl & dai::CameraControl::setSaturation ( int  value)

Set a command to adjust image saturation

Parameters
valueSaturation, range -10..10, default 0

Definition at line 177 of file CameraControl.cpp.

◆ setSceneMode()

CameraControl & dai::CameraControl::setSceneMode ( SceneMode  mode)

Set a command to specify scene mode

Parameters
modeScene mode

Definition at line 197 of file CameraControl.cpp.

◆ setSharpness()

CameraControl & dai::CameraControl::setSharpness ( int  value)

Set a command to adjust image sharpness

Parameters
valueSharpness, range 0..4, default 1

Definition at line 182 of file CameraControl.cpp.

◆ setStartStreaming()

CameraControl & dai::CameraControl::setStartStreaming ( )

Set a command to start streaming

Definition at line 20 of file CameraControl.cpp.

◆ setStopStreaming()

CameraControl & dai::CameraControl::setStopStreaming ( )

Set a command to stop streaming

Definition at line 24 of file CameraControl.cpp.

◆ setStrobeDisable()

CameraControl & dai::CameraControl::setStrobeDisable ( )

Disable STROBE output

Definition at line 57 of file CameraControl.cpp.

◆ setStrobeExternal()

CameraControl & dai::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

Definition at line 49 of file CameraControl.cpp.

◆ setStrobeSensor()

CameraControl & dai::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

Definition at line 41 of file CameraControl.cpp.

Member Data Documentation

◆ cfg

RawCameraControl& dai::CameraControl::cfg
private

Definition at line 35 of file CameraControl.hpp.


The documentation for this class was generated from the following files:


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:20