ON THIS PAGE

  • ImgFrame
  • Examples of functionality
  • Reference

ImgFrame

These are all the images (regardless of their encoding/format), as well as the depth/disparity "image". Camera is the source of the image frame messages.

Examples of functionality

Reference

class

dai::ImgFrame

#include ImgFrame.hpp
variable
variable
Specs sourceFb
variable
variable
uint32_t category
variable
uint32_t instanceNum
variable
dai::FrameEvent event
variable
ImgTransformation transformation
function
ImgFrame()
Construct ImgFrame message. Timestamp is set to now
function
ImgFrame(long fd)
function
ImgFrame(size_t size)
function
ImgFrame(long fd, size_t size)
function
~ImgFrame()
inline function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)
function
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestamp(CameraExposureOffset offset)
Retrieves image timestamp (at the specified offset of exposure) related to dai::Clock::now()
function
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestampDevice(CameraExposureOffset offset)
Retrieves image timestamp (at the specified offset of exposure) directly captured from device's monotonic clock, not synchronized to host time. Used when monotonicity is required.
function
unsigned int getInstanceNum()
Retrieves instance number
function
unsigned int getCategory()
Retrieves image category
function
unsigned int getWidth()
Retrieves image width in pixels
function
unsigned int getStride()
Retrieves image line stride in bytes
function
unsigned int getPlaneStride(int planeIndex)
Retrieves image plane stride (offset to next plane) in bytes
Parameters
  • current: plane index, 0 or 1
function
unsigned int getHeight()
Retrieves image height in pixels
function
unsigned int getPlaneHeight()
Retrieves image plane height in lines
function
unsigned int getSourceWidth()
Retrieves source image width in pixels
function
unsigned int getSourceHeight()
Retrieves source image height in pixels
function
Type getType()
Retrieves image type
function
float getBytesPerPixel()
Retrieves image bytes per pixel
function
std::chrono::microseconds getExposureTime()
Retrieves exposure time
function
int getSensitivity()
Retrieves sensitivity, as an ISO value
function
int getColorTemperature()
Retrieves white-balance color temperature of the light source, in kelvins
function
int getLensPosition()
Retrieves lens position, range 0..255. Returns -1 if not available
function
float getLensPositionRaw()
Retrieves lens position, range 0.0f..1.0f. Returns -1 if not available
function
ImgFrame & setInstanceNum(unsigned int instance)
Instance number relates to the origin of the frame (which camera)
Parameters
  • instance: Instance number
function
ImgFrame & setCategory(unsigned int category)
Parameters
  • category: Image category
function
ImgFrame & setWidth(unsigned int width)
Specifies frame width
Parameters
  • width: frame width
function
ImgFrame & setStride(unsigned int stride)
Specifies frame stride
Parameters
  • stride: frame stride
function
ImgFrame & setHeight(unsigned int height)
Specifies frame height
Parameters
  • height: frame height
function
ImgFrame & setSize(unsigned int width, unsigned int height)
Specifies frame size
Parameters
  • height: frame height
  • width: frame width
function
ImgFrame & setSize(std::tuple< unsigned int, unsigned int > size)
Specifies frame size
Parameters
  • size: frame size
function
ImgFrame & setSourceSize(unsigned int width, unsigned int height)
Specifies source frame size
Parameters
  • height: frame height
  • width: frame width
function
ImgFrame & setSourceSize(std::tuple< unsigned int, unsigned int > size)
Specifies source frame size
Parameters
  • size: frame size
function
ImgFrame & setType(Type type)
Specifies frame type, RGB, BGR, ...
Parameters
  • type: Type of image
function
Point2f remapPointFromSource(const Point2f & point)
Remap a point from the current frame to the source frame
Parameters
  • point: point to remap
Returns
remapped point
function
Point2f remapPointToSource(const Point2f & point)
Remap a point from the source frame to the current frame
Parameters
  • point: point to remap
Returns
remapped point
function
Rect remapRectFromSource(const Rect & rect)
Remap a rectangle from the source frame to the current frame
Parameters
  • rect: rectangle to remap
Returns
remapped rectangle
function
Rect remapRectToSource(const Rect & rect)
Remap a rectangle from the current frame to the source frame
Parameters
  • rect: rectangle to remap
Returns
remapped rectangle
function
ImgFrame & setMetadata(const ImgFrame & sourceFrame)
Convience function to initialize meta data from another frame Copies over timestamps, transformations done on the image, etc.
Parameters
  • sourceFrame: source frame from which the metadata is taken from
function
ImgFrame & setMetadata(const std::shared_ptr< ImgFrame > & sourceFrame)
Convience function to initialize meta data from another frame Copies over timestamps, transformations done on the image, etc.
Parameters
  • sourceFrame: shared pointer to source frame from which the metadata is taken from
function
float getSourceDFov()
Parameters
Fov API works correctly only on rectilinear frames Get the source diagonal field of view in degrees
Returns
field of view in degrees
function
float getSourceHFov()
Parameters
Fov API works correctly only on rectilinear frames Get the source horizontal field of view
Parameters
  • degrees: field of view in degrees
function
float getSourceVFov()
Parameters
Fov API works correctly only on rectilinear frames Get the source vertical field of view
Parameters
  • degrees: field of view in degrees
function
bool validateTransformations()
Check that the image transformation match the image size
Returns
true if the transformations are valid
function
ImgFrame & setFrame(cv::Mat frame)
Parameters
This API only available if OpenCV support is enabled
ImgFrame buffer
Parameters
  • frame: Input cv::Mat frame from which to copy the data
function
cv::Mat getFrame(bool copy)
Parameters
This API only available if OpenCV support is enabled
Parameters
  • copy: If false only a reference to data is made, otherwise a copy
Returns
cv::Mat with corresponding to ImgFrame parameters
function
cv::Mat getCvFrame(cv::MatAllocator * allocator)
Parameters
This API only available if OpenCV support is enabled
ImgFrame is converted to color BGR interleaved or grayscale depending on type.A copy is always made
Returns
cv::Mat for use in opencv functions
function
ImgFrame & setCvFrame(cv::Mat frame, Type type)
Parameters
This API only available if OpenCV support is enabled
ImgFrame buffer and converts to a specific type.
Parameters
  • frame: Input cv::Mat BGR frame from which to copy the data
function
DEPTHAI_SERIALIZE(ImgFrame, Buffer::ts, Buffer::tsDevice, Buffer::sequenceNum, fb, sourceFb, cam, category, instanceNum, transformation)
function
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestamp()
Retrieves timestamp related to dai::Clock::now()
function
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestampDevice()
Retrieves timestamp directly captured from device's monotonic clock, not synchronized to host time. Used mostly for debugging
struct

dai::ImgFrame::CameraSettings

variable
int32_t exposureTimeUs
variable
int32_t sensitivityIso
variable
int32_t lensPosition
variable
int32_t wbColorTemp
variable
float lensPositionRaw
function
DEPTHAI_SERIALIZE(CameraSettings, exposureTimeUs, sensitivityIso, lensPosition, wbColorTemp, lensPositionRaw)
struct

dai::ImgFrame::Specs

variable
Type type
variable
unsigned int width
variable
unsigned int height
variable
unsigned int stride
variable
unsigned int bytesPP
variable
unsigned int p1Offset
variable
unsigned int p2Offset
variable
unsigned int p3Offset
function
DEPTHAI_SERIALIZE(Specs, type, width, height, stride, bytesPP, p1Offset, p2Offset, p3Offset)
enum

Type

enumerator
YUV422i
enumerator
YUV444p
enumerator
YUV420p
enumerator
YUV422p
enumerator
YUV400p
enumerator
RGBA8888
enumerator
RGB161616
enumerator
RGB888p
enumerator
BGR888p
enumerator
RGB888i
enumerator
BGR888i
enumerator
LUT2
enumerator
LUT4
enumerator
LUT16
enumerator
RAW16
enumerator
RAW14
enumerator
RAW12
enumerator
RAW10
enumerator
RAW8
enumerator
PACK10
enumerator
PACK12
enumerator
YUV444i
enumerator
NV12
enumerator
NV21
enumerator
BITSTREAM
enumerator
HDR
enumerator
RGBF16F16F16p
enumerator
BGRF16F16F16p
enumerator
RGBF16F16F16i
enumerator
BGRF16F16F16i
enumerator
GRAY8
enumerator
GRAYF16
enumerator
RAW32
enumerator
NONE

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.