Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
dai::node::Camera Class Reference

Camera node. Experimental node, for both mono and color types of sensors. More...

#include <Camera.hpp>

Inheritance diagram for dai::node::Camera:
Inheritance graph
[legend]

Public Member Functions

 Camera (const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
 
 Camera (const std::shared_ptr< PipelineImpl > &par, int64_t nodeId, std::unique_ptr< Properties > props)
 
CameraBoardSocket getBoardSocket () const
 
tl::optional< float > getCalibrationAlpha () const
 Get calibration alpha parameter that determines FOV of undistorted frames. More...
 
std::string getCamera () const
 
float getFps () const
 
int getHeight () const
 Get sensor resolution height. More...
 
CameraImageOrientation getImageOrientation () const
 Get camera image orientation. More...
 
Properties::WarpMeshSource getMeshSource () const
 Gets the source of the warp mesh. More...
 
std::tuple< int, int > getMeshStep () const
 Gets the distance between mesh points. More...
 
int getPreviewHeight () const
 Get preview height. More...
 
std::tuple< int, int > getPreviewSize () const
 Get preview size as tuple. More...
 
int getPreviewWidth () const
 Get preview width. More...
 
std::tuple< int, int > getSize () const
 Get sensor resolution as size. More...
 
int getStillHeight () const
 Get still height. More...
 
std::tuple< int, int > getStillSize () const
 Get still size as tuple. More...
 
int getStillWidth () const
 Get still width. More...
 
int getVideoHeight () const
 Get video height. More...
 
std::tuple< int, int > getVideoSize () const
 Get video size as tuple. More...
 
int getVideoWidth () const
 Get video width. More...
 
int getWidth () const
 Get sensor resolution width. More...
 
void loadMeshData (span< const std::uint8_t > warpMesh)
 
void loadMeshFile (const dai::Path &warpMesh)
 
void setBoardSocket (CameraBoardSocket boardSocket)
 
void setCalibrationAlpha (float alpha)
 Set calibration alpha parameter that determines FOV of undistorted frames. More...
 
void setCamera (std::string name)
 
void setFps (float fps)
 
void setImageOrientation (CameraImageOrientation imageOrientation)
 Set camera image orientation. More...
 
void setIsp3aFps (int isp3aFps)
 
void setMeshSource (Properties::WarpMeshSource source)
 Set the source of the warp mesh or disable. More...
 
void setMeshStep (int width, int height)
 
void setPreviewSize (int width, int height)
 Set preview output size. More...
 
void setPreviewSize (std::tuple< int, int > size)
 Set preview output size, as a tuple <width, height> More...
 
void setRawOutputPacked (bool packed)
 
void setSize (int width, int height)
 Set desired resolution. Sets sensor size to best fit. More...
 
void setSize (std::tuple< int, int > size)
 Set desired resolution. Sets sensor size to best fit. More...
 
void setStillSize (int width, int height)
 Set still output size. More...
 
void setStillSize (std::tuple< int, int > size)
 Set still output size, as a tuple <width, height> More...
 
void setVideoSize (int width, int height)
 Set video output size. More...
 
void setVideoSize (std::tuple< int, int > size)
 Set video output size, as a tuple <width, height> More...
 
- Public Member Functions inherited from dai::NodeCRTP< Node, Camera, CameraProperties >
std::unique_ptr< Nodeclone () const override
 
const char * getName () const override
 
- Public Member Functions inherited from dai::Node
virtual std::unique_ptr< Nodeclone () const =0
 Deep copy the node. More...
 
AssetManagergetAssetManager ()
 Get node AssetManager as a reference. More...
 
const AssetManagergetAssetManager () const
 Get node AssetManager as a const reference. More...
 
std::vector< Input * > getInputRefs ()
 Retrieves reference to node inputs. More...
 
std::vector< const Input * > getInputRefs () const
 Retrieves reference to node inputs. More...
 
std::vector< InputgetInputs ()
 Retrieves all nodes inputs. More...
 
virtual const char * getName () const =0
 Retrieves nodes name. More...
 
std::vector< Output * > getOutputRefs ()
 Retrieves reference to node outputs. More...
 
std::vector< const Output * > getOutputRefs () const
 Retrieves reference to node outputs. More...
 
std::vector< OutputgetOutputs ()
 Retrieves all nodes outputs. More...
 
Pipeline getParentPipeline ()
 
const Pipeline getParentPipeline () const
 
 Node (const std::shared_ptr< PipelineImpl > &p, Id nodeId, std::unique_ptr< Properties > props)
 Constructs Node. More...
 
virtual ~Node ()=default
 

Static Public Member Functions

static int getScaledSize (int input, int num, int denom)
 

Public Attributes

Output frameEvent {*this, "frameEvent", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}
 
CameraControl initialControl
 
Input inputConfig {*this, "inputConfig", Input::Type::SReceiver, false, 8, {{DatatypeEnum::ImageManipConfig, false}}}
 
Input inputControl {*this, "inputControl", Input::Type::SReceiver, true, 8, {{DatatypeEnum::CameraControl, false}}}
 
Output isp {*this, "isp", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}
 
Output preview {*this, "preview", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}
 
Output raw {*this, "raw", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}
 
Output still {*this, "still", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}
 
Output video {*this, "video", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}
 
- Public Attributes inherited from dai::NodeCRTP< Node, Camera, CameraProperties >
Propertiesproperties
 Underlying properties. More...
 
- Public Attributes inherited from dai::Node
const Id id
 Id of node. More...
 
Propertiesproperties
 

Static Public Attributes

constexpr static const char * NAME = "Camera"
 

Protected Member Functions

PropertiesgetProperties ()
 
- Protected Member Functions inherited from dai::Node
virtual tl::optional< OpenVINO::VersiongetRequiredOpenVINOVersion ()
 
void setInputMapRefs (InputMap *inMapRef)
 
void setInputMapRefs (std::initializer_list< InputMap * > l)
 
void setInputRefs (Input *inRef)
 
void setInputRefs (std::initializer_list< Input * > l)
 
void setOutputMapRefs (OutputMap *outMapRef)
 
void setOutputMapRefs (std::initializer_list< OutputMap * > l)
 
void setOutputRefs (Output *outRef)
 
void setOutputRefs (std::initializer_list< Output * > l)
 

Private Attributes

std::shared_ptr< RawCameraControlrawControl
 

Additional Inherited Members

- Public Types inherited from dai::NodeCRTP< Node, Camera, CameraProperties >
using Properties = CameraProperties
 
- Public Types inherited from dai::Node
using Id = std::int64_t
 Node identificator. Unique for every node on a single Pipeline. More...
 
- Protected Attributes inherited from dai::Node
AssetManager assetManager
 
std::unordered_map< std::string, InputMap * > inputMapRefs
 
std::unordered_map< std::string, Input * > inputRefs
 
std::unordered_map< std::string, OutputMap * > outputMapRefs
 
std::unordered_map< std::string, Output * > outputRefs
 
std::weak_ptr< PipelineImplparent
 
copyable_unique_ptr< PropertiespropertiesHolder
 

Detailed Description

Camera node. Experimental node, for both mono and color types of sensors.

Definition at line 18 of file Camera.hpp.

Constructor & Destructor Documentation

◆ Camera() [1/2]

dai::node::Camera::Camera ( const std::shared_ptr< PipelineImpl > &  par,
int64_t  nodeId 
)

Constructs Camera node.

Definition at line 13 of file Camera.cpp.

◆ Camera() [2/2]

dai::node::Camera::Camera ( const std::shared_ptr< PipelineImpl > &  par,
int64_t  nodeId,
std::unique_ptr< Properties props 
)

Definition at line 14 of file Camera.cpp.

Member Function Documentation

◆ getBoardSocket()

CameraBoardSocket dai::node::Camera::getBoardSocket ( ) const

Retrieves which board socket to use

Returns
Board socket to use

Definition at line 40 of file Camera.cpp.

◆ getCalibrationAlpha()

tl::optional< float > dai::node::Camera::getCalibrationAlpha ( ) const

Get calibration alpha parameter that determines FOV of undistorted frames.

Definition at line 274 of file Camera.cpp.

◆ getCamera()

std::string dai::node::Camera::getCamera ( ) const

Retrieves which camera to use by name

Returns
Name of the camera to use

Definition at line 48 of file Camera.cpp.

◆ getFps()

float dai::node::Camera::getFps ( ) const

Get rate at which camera should produce frames

Returns
Rate in frames per second

Definition at line 137 of file Camera.cpp.

◆ getHeight()

int dai::node::Camera::getHeight ( ) const

Get sensor resolution height.

Definition at line 199 of file Camera.cpp.

◆ getImageOrientation()

CameraImageOrientation dai::node::Camera::getImageOrientation ( ) const

Get camera image orientation.

Definition at line 58 of file Camera.cpp.

◆ getMeshSource()

Camera::Properties::WarpMeshSource dai::node::Camera::getMeshSource ( ) const

Gets the source of the warp mesh.

Definition at line 234 of file Camera.cpp.

◆ getMeshStep()

std::tuple< int, int > dai::node::Camera::getMeshStep ( ) const

Gets the distance between mesh points.

Definition at line 266 of file Camera.cpp.

◆ getPreviewHeight()

int dai::node::Camera::getPreviewHeight ( ) const

Get preview height.

Definition at line 156 of file Camera.cpp.

◆ getPreviewSize()

std::tuple< int, int > dai::node::Camera::getPreviewSize ( ) const

Get preview size as tuple.

Definition at line 148 of file Camera.cpp.

◆ getPreviewWidth()

int dai::node::Camera::getPreviewWidth ( ) const

Get preview width.

Definition at line 152 of file Camera.cpp.

◆ getProperties()

Camera::Properties & dai::node::Camera::getProperties ( )
protectedvirtual

Reimplemented from dai::Node.

Definition at line 29 of file Camera.cpp.

◆ getScaledSize()

static int dai::node::Camera::getScaledSize ( int  input,
int  num,
int  denom 
)
static

Computes the scaled size given numerator and denominator

◆ getSize()

std::tuple< int, int > dai::node::Camera::getSize ( ) const

Get sensor resolution as size.

Definition at line 190 of file Camera.cpp.

◆ getStillHeight()

int dai::node::Camera::getStillHeight ( ) const

Get still height.

Definition at line 185 of file Camera.cpp.

◆ getStillSize()

std::tuple< int, int > dai::node::Camera::getStillSize ( ) const

Get still size as tuple.

Definition at line 175 of file Camera.cpp.

◆ getStillWidth()

int dai::node::Camera::getStillWidth ( ) const

Get still width.

Definition at line 181 of file Camera.cpp.

◆ getVideoHeight()

int dai::node::Camera::getVideoHeight ( ) const

Get video height.

Definition at line 170 of file Camera.cpp.

◆ getVideoSize()

std::tuple< int, int > dai::node::Camera::getVideoSize ( ) const

Get video size as tuple.

Definition at line 161 of file Camera.cpp.

◆ getVideoWidth()

int dai::node::Camera::getVideoWidth ( ) const

Get video width.

Definition at line 166 of file Camera.cpp.

◆ getWidth()

int dai::node::Camera::getWidth ( ) const

Get sensor resolution width.

Definition at line 195 of file Camera.cpp.

◆ loadMeshData()

void dai::node::Camera::loadMeshData ( span< const std::uint8_t >  warpMesh)

Specify mesh calibration data for undistortion See loadMeshFiles for the expected data format

Definition at line 238 of file Camera.cpp.

◆ loadMeshFile()

void dai::node::Camera::loadMeshFile ( const dai::Path warpMesh)

Specify local filesystem paths to the undistort mesh calibration files.

When a mesh calibration is set, it overrides the camera intrinsics/extrinsics matrices. Overrides useHomographyRectification behavior. Mesh format: a sequence of (y,x) points as 'float' with coordinates from the input image to be mapped in the output. The mesh can be subsampled, configured by setMeshStep.

With a 1280x800 resolution and the default (16,16) step, the required mesh size is:

width: 1280 / 16 + 1 = 81

height: 800 / 16 + 1 = 51

Definition at line 252 of file Camera.cpp.

◆ setBoardSocket()

void dai::node::Camera::setBoardSocket ( dai::CameraBoardSocket  boardSocket)

Specify which board socket to use

Parameters
boardSocketBoard socket to use

Definition at line 35 of file Camera.cpp.

◆ setCalibrationAlpha()

void dai::node::Camera::setCalibrationAlpha ( float  alpha)

Set calibration alpha parameter that determines FOV of undistorted frames.

Definition at line 270 of file Camera.cpp.

◆ setCamera()

void dai::node::Camera::setCamera ( std::string  name)

Specify which camera to use by name

Parameters
nameName of the camera to use

Definition at line 44 of file Camera.cpp.

◆ setFps()

void dai::node::Camera::setFps ( float  fps)

Set rate at which camera should produce frames

Parameters
fpsRate in frames per second

Definition at line 129 of file Camera.cpp.

◆ setImageOrientation()

void dai::node::Camera::setImageOrientation ( CameraImageOrientation  imageOrientation)

Set camera image orientation.

Definition at line 53 of file Camera.cpp.

◆ setIsp3aFps()

void dai::node::Camera::setIsp3aFps ( int  isp3aFps)

Isp 3A rate (auto focus, auto exposure, auto white balance, camera controls etc.). Default (0) matches the camera FPS, meaning that 3A is running on each frame. Reducing the rate of 3A reduces the CPU usage on CSS, but also increases the convergence rate of 3A. Note that camera controls will be processed at this rate. E.g. if camera is running at 30 fps, and camera control is sent at every frame, but 3A fps is set to 15, the camera control messages will be processed at 15 fps rate, which will lead to queueing.

Definition at line 133 of file Camera.cpp.

◆ setMeshSource()

void dai::node::Camera::setMeshSource ( Properties::WarpMeshSource  source)

Set the source of the warp mesh or disable.

Definition at line 231 of file Camera.cpp.

◆ setMeshStep()

void dai::node::Camera::setMeshStep ( int  width,
int  height 
)

Set the distance between mesh points. Default: (32, 32)

Definition at line 262 of file Camera.cpp.

◆ setPreviewSize() [1/2]

void dai::node::Camera::setPreviewSize ( int  width,
int  height 
)

Set preview output size.

Definition at line 64 of file Camera.cpp.

◆ setPreviewSize() [2/2]

void dai::node::Camera::setPreviewSize ( std::tuple< int, int >  size)

Set preview output size, as a tuple <width, height>

Definition at line 69 of file Camera.cpp.

◆ setRawOutputPacked()

void dai::node::Camera::setRawOutputPacked ( bool  packed)

Configures whether the camera raw frames are saved as MIPI-packed to memory. The packed format is more efficient, consuming less memory on device, and less data to send to host: RAW10: 4 pixels saved on 5 bytes, RAW12: 2 pixels saved on 3 bytes. When packing is disabled (false), data is saved lsb-aligned, e.g. a RAW10 pixel will be stored as uint16, on bits 9..0: 0b0000'00pp'pppp'pppp. Default is auto: enabled for standard color/monochrome cameras where ISP can work with both packed/unpacked, but disabled for other cameras like ToF.

Definition at line 278 of file Camera.cpp.

◆ setSize() [1/2]

void dai::node::Camera::setSize ( int  width,
int  height 
)

Set desired resolution. Sets sensor size to best fit.

Definition at line 84 of file Camera.cpp.

◆ setSize() [2/2]

void dai::node::Camera::setSize ( std::tuple< int, int >  size)

Set desired resolution. Sets sensor size to best fit.

Definition at line 89 of file Camera.cpp.

◆ setStillSize() [1/2]

void dai::node::Camera::setStillSize ( int  width,
int  height 
)

Set still output size.

Definition at line 94 of file Camera.cpp.

◆ setStillSize() [2/2]

void dai::node::Camera::setStillSize ( std::tuple< int, int >  size)

Set still output size, as a tuple <width, height>

Definition at line 99 of file Camera.cpp.

◆ setVideoSize() [1/2]

void dai::node::Camera::setVideoSize ( int  width,
int  height 
)

Set video output size.

Definition at line 74 of file Camera.cpp.

◆ setVideoSize() [2/2]

void dai::node::Camera::setVideoSize ( std::tuple< int, int >  size)

Set video output size, as a tuple <width, height>

Definition at line 79 of file Camera.cpp.

Member Data Documentation

◆ frameEvent

Output dai::node::Camera::frameEvent {*this, "frameEvent", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs metadata-only ImgFrame message as an early indicator of an incoming frame.

It's sent on the MIPI SoF (start-of-frame) event, just after the exposure of the current frame has finished and before the exposure for next frame starts. Could be used to synchronize various processes with camera capture. Fields populated: camera id, sequence number, timestamp

Definition at line 102 of file Camera.hpp.

◆ initialControl

CameraControl dai::node::Camera::initialControl

Initial control options to apply to sensor

Definition at line 43 of file Camera.hpp.

◆ inputConfig

Input dai::node::Camera::inputConfig {*this, "inputConfig", Input::Type::SReceiver, false, 8, {{DatatypeEnum::ImageManipConfig, false}}}

Input for ImageManipConfig message, which can modify crop parameters in runtime

Default queue is non-blocking with size 8

Definition at line 50 of file Camera.hpp.

◆ inputControl

Input dai::node::Camera::inputControl {*this, "inputControl", Input::Type::SReceiver, true, 8, {{DatatypeEnum::CameraControl, false}}}

Input for CameraControl message, which can modify camera parameters in runtime

Default queue is blocking with size 8

Definition at line 57 of file Camera.hpp.

◆ isp

Output dai::node::Camera::isp {*this, "isp", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries YUV420 planar (I420/IYUV) frame data.

Generated by the ISP engine, and the source for the 'video', 'preview' and 'still' outputs

Definition at line 85 of file Camera.hpp.

◆ NAME

constexpr static const char* dai::node::Camera::NAME = "Camera"
staticconstexpr

Definition at line 20 of file Camera.hpp.

◆ preview

Output dai::node::Camera::preview {*this, "preview", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries BGR/RGB planar/interleaved encoded frame data.

Suitable for use with NeuralNetwork node

Definition at line 71 of file Camera.hpp.

◆ raw

Output dai::node::Camera::raw {*this, "raw", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries RAW10-packed (MIPI CSI-2 format) frame data.

Captured directly from the camera sensor, and the source for the 'isp' output.

Definition at line 92 of file Camera.hpp.

◆ rawControl

std::shared_ptr<RawCameraControl> dai::node::Camera::rawControl
private

Definition at line 26 of file Camera.hpp.

◆ still

Output dai::node::Camera::still {*this, "still", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries NV12 encoded (YUV420, UV plane interleaved) frame data.

The message is sent only when a CameraControl message arrives to inputControl with captureStill command set.

Definition at line 78 of file Camera.hpp.

◆ video

Output dai::node::Camera::video {*this, "video", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries NV12 encoded (YUV420, UV plane interleaved) frame data.

Suitable for use with VideoEncoder node

Definition at line 64 of file Camera.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