Class ImgFrame
Defined in File ImgFrame.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Types
public dai::Buffer(Class Buffer)public dai::ProtoSerializable(Class ProtoSerializable)
Class Documentation
-
class ImgFrame : public dai::Buffer, public dai::ProtoSerializable
ImgFrame message. Carries image data and metadata.
Public Types
-
enum class Type
Values:
-
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
-
enumerator YUV422i
Public Functions
-
ImgFrame(long fd)
-
ImgFrame(size_t size)
-
ImgFrame(long fd, size_t size)
-
virtual ~ImgFrame()
-
virtual void serialize(std::vector<std::uint8_t> &metadata, DatatypeEnum &datatype) const override
-
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> getTimestamp(CameraExposureOffset offset) const
Retrieves image timestamp (at the specified offset of exposure) related to dai::Clock::now()
-
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> getTimestampDevice(CameraExposureOffset offset) const
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.
-
unsigned int getInstanceNum() const
Retrieves instance number
-
unsigned int getCategory() const
Retrieves image category
-
unsigned int getWidth() const
Retrieves image width in pixels
-
unsigned int getStride() const
Retrieves image line stride in bytes
-
unsigned int getPlaneStride(int planeIndex = 0) const
Retrieves image plane stride (offset to next plane) in bytes
- Parameters:
current – plane index, 0 or 1
-
unsigned int getHeight() const
Retrieves image height in pixels
-
unsigned int getPlaneHeight() const
Retrieves image plane height in lines
-
unsigned int getSourceWidth() const
Retrieves source image width in pixels
-
unsigned int getSourceHeight() const
Retrieves source image height in pixels
-
float getBytesPerPixel() const
Retrieves image bytes per pixel
-
std::chrono::microseconds getExposureTime() const
Retrieves exposure time
-
int getSensitivity() const
Retrieves sensitivity, as an ISO value
-
int getColorTemperature() const
Retrieves white-balance color temperature of the light source, in kelvins
-
int getLensPosition() const
Retrieves lens position, range 0..255. Returns -1 if not available
-
float getLensPositionRaw() const
Retrieves lens position, range 0.0f..1.0f. Returns -1 if not available
-
ImgFrame &setInstanceNum(unsigned int instance)
Instance number relates to the origin of the frame (which camera)
- Parameters:
instance – Instance number
-
ImgFrame &setSize(unsigned int width, unsigned int height)
Specifies frame size
- Parameters:
height – frame height
width – frame width
-
ImgFrame &setSize(std::tuple<unsigned int, unsigned int> size)
Specifies frame size
- Parameters:
size – frame size
-
ImgFrame &setSourceSize(unsigned int width, unsigned int height)
Specifies source frame size
- Parameters:
height – frame height
width – frame width
-
ImgFrame &setSourceSize(std::tuple<unsigned int, unsigned int> size)
Specifies source frame size
- Parameters:
size – frame size
-
Point2f remapPointFromSource(const Point2f &point) const
Remap a point from the current frame to the source frame
- Parameters:
point – point to remap
- Returns:
remapped point
-
Point2f remapPointToSource(const Point2f &point) const
Remap a point from the source frame to the current frame
- Parameters:
point – point to remap
- Returns:
remapped point
-
Rect remapRectFromSource(const Rect &rect) const
Remap a rectangle from the source frame to the current frame
- Parameters:
rect – rectangle to remap
- Returns:
remapped rectangle
-
Rect remapRectToSource(const Rect &rect) const
Remap a rectangle from the current frame to the source frame
- Parameters:
rect – rectangle to remap
- Returns:
remapped rectangle
-
ImgFrame &setMetadata(const ImgFrame &sourceFrame)
Convenience 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
Convenience 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
-
ImgFrame ©DataFrom(const ImgFrame &sourceFrame)
Convenience function to set the data of the ImgFrame
- Parameters:
data – data to set
Convenience function to set the data of the ImgFrame
- Parameters:
data – data to set
-
std::shared_ptr<ImgFrame> clone() const
Create a clone of the ImgFrame with metadata and data copied
- Returns:
cloned ImgFrame
-
float getSourceDFov() const
Note
Fov API works correctly only on rectilinear frames Get the source diagonal field of view in degrees
- Returns:
field of view in degrees
-
float getSourceHFov() const
Note
Fov API works correctly only on rectilinear frames Get the source horizontal field of view
- Parameters:
degrees – field of view in degrees
-
float getSourceVFov() const
Note
Fov API works correctly only on rectilinear frames Get the source vertical field of view
- Parameters:
degrees – field of view in degrees
-
bool validateTransformations() const
Check that the image transformation match the image size
- Returns:
true if the transformations are valid
-
DEPTHAI_SERIALIZE(ImgFrame, Buffer::ts, Buffer::tsDevice, Buffer::sequenceNum, fb, sourceFb, cam, category, instanceNum, transformation)
-
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> getTimestamp() const
Retrieves timestamp related to dai::Clock::now()
-
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> getTimestampDevice() const
Retrieves timestamp directly captured from device’s monotonic clock, not synchronized to host time. Used mostly for debugging
Public Members
-
CameraSettings cam
-
uint32_t category = 0
-
uint32_t instanceNum = 0
-
dai::FrameEvent event = dai::FrameEvent::NONE
-
ImgTransformation transformation
Public Static Functions
-
static Point2f remapPointBetweenFrames(const Point2f &originPoint, const ImgFrame &originFrame, const ImgFrame &destFrame)
Remap point between two frames
- Parameters:
originPoint – point to remap
originFrame – origin frame
destFrame – destination frame
- Returns:
remapped point
-
struct CameraSettings
Public Functions
-
DEPTHAI_SERIALIZE(CameraSettings, exposureTimeUs, sensitivityIso, lensPosition, wbColorTemp, lensPositionRaw)
-
DEPTHAI_SERIALIZE(CameraSettings, exposureTimeUs, sensitivityIso, lensPosition, wbColorTemp, lensPositionRaw)
-
enum class Type