ImgFrame¶
These are all the images (regardless of their encoding/format), as well as the depth/disparity “image”. ColorCamera and MonoCamera are the source of the image frame messages.
Examples of functionality¶
Reference¶
-
class
depthai.
ImgFrame
ImgFrame message. Carries image data and metadata.
-
class
Type
Members:
YUV422i
YUV444p
YUV420p
YUV422p
YUV400p
RGBA8888
RGB161616
RGB888p
BGR888p
RGB888i
BGR888i
RGBF16F16F16p
BGRF16F16F16p
RGBF16F16F16i
BGRF16F16F16i
GRAY8
GRAYF16
LUT2
LUT4
LUT16
RAW16
RAW14
RAW12
RAW10
RAW8
PACK10
PACK12
YUV444i
NV12
NV21
BITSTREAM
HDR
NONE
-
property
name
-
property
-
getCategory
(self: depthai.ImgFrame) → int Retrieves image category
-
getColorTemperature
(self: depthai.ImgFrame) → int Retrieves white-balance color temperature of the light source, in kelvins
-
getCvFrame
(self: object) → object Returns BGR or grayscale frame compatible with use in other opencv functions
-
getData
(self: object) → numpy.ndarray[numpy.uint8] Get non-owning reference to internal buffer
- Returns
Reference to internal buffer
-
getExposureTime
(self: depthai.ImgFrame) → datetime.timedelta Retrieves exposure time
-
getFrame
(self: object, copy: bool = False) → numpy.ndarray Returns numpy array with shape as specified by width, height and type
-
getHeight
(self: depthai.ImgFrame) → int Retrieves image height in pixels
-
getInstanceNum
(self: depthai.ImgFrame) → int Retrieves instance number
-
getLensPosition
(self: depthai.ImgFrame) → int Retrieves lens position, range 0..255. Returns -1 if not available
-
getRaw
(self: depthai.ADatatype) → depthai.RawBuffer
-
getSensitivity
(self: depthai.ImgFrame) → int Retrieves sensitivity, as an ISO value
-
getSequenceNum
(self: depthai.ImgFrame) → int Retrieves sequence number
-
getTimestamp
(*args, **kwargs) Overloaded function.
getTimestamp(self: depthai.ImgFrame) -> datetime.timedelta
Retrieves timestamp related to dai::Clock::now()
getTimestamp(self: depthai.ImgFrame, offset: depthai.CameraExposureOffset) -> datetime.timedelta
Retrieves image timestamp (at the specified offset of exposure) related to dai::Clock::now()
-
getTimestampDevice
(*args, **kwargs) Overloaded function.
getTimestampDevice(self: depthai.ImgFrame) -> datetime.timedelta
Retrieves timestamp directly captured from device’s monotonic clock, not synchronized to host time. Used mostly for debugging
getTimestampDevice(self: depthai.ImgFrame, offset: depthai.CameraExposureOffset) -> datetime.timedelta
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.
-
getType
(self: depthai.ImgFrame) → depthai.RawImgFrame.Type Retrieves image type
-
getWidth
(self: depthai.ImgFrame) → int Retrieves image width in pixels
-
setCategory
(self: depthai.ImgFrame, category: int) → depthai.ImgFrame - Parameter
category
: Image category
- 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
-
setFrame
(self: depthai.ImgFrame, array: numpy.ndarray) → None Copies array bytes to ImgFrame buffer
-
setHeight
(self: depthai.ImgFrame, height: int) → depthai.ImgFrame Specifies frame height
- Parameter
height
: frame height
- Parameter
-
setInstanceNum
(self: depthai.ImgFrame, instance: int) → depthai.ImgFrame Instance number relates to the origin of the frame (which camera)
- Parameter
instance
: Instance number
- Parameter
-
setSequenceNum
(self: depthai.ImgFrame, seq: int) → depthai.ImgFrame Specifies sequence number
- Parameter
seq
: Sequence number
- Parameter
-
setSize
(*args, **kwargs) Overloaded function.
setSize(self: depthai.ImgFrame, width: int, height: int) -> depthai.ImgFrame
Specifies frame size
- Parameter
height
: frame height
- Parameter
width
: frame width
setSize(self: depthai.ImgFrame, sizer: Tuple[int, int]) -> depthai.ImgFrame
Specifies frame size
- Parameter
size
: frame size
-
setTimestamp
(self: depthai.ImgFrame, timestamp: datetime.timedelta) → depthai.ImgFrame Retrieves image timestamp related to dai::Clock::now()
-
setTimestampDevice
(self: depthai.ImgFrame, arg0: datetime.timedelta) → depthai.ImgFrame Sets image timestamp related to dai::Clock::now()
-
setType
(self: depthai.ImgFrame, type: depthai.RawImgFrame.Type) → depthai.ImgFrame Specifies frame type, RGB, BGR, …
- Parameter
type
: Type of image
- Parameter
-
setWidth
(self: depthai.ImgFrame, width: int) → depthai.ImgFrame Specifies frame width
- Parameter
width
: frame width
- Parameter
-
class
-
class
dai
::
ImgFrame
: public dai::Buffer¶ ImgFrame message. Carries image data and metadata.
Public Types
-
using
Type
= RawImgFrame::Type¶
-
using
Specs
= RawImgFrame::Specs¶
-
using
CameraSettings
= RawImgFrame::CameraSettings¶
Public Functions
-
~ImgFrame
() = default¶
-
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
getHeight
() const¶ Retrieves image height in pixels
-
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
-
ImgFrame &
setTimestamp
(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> timestamp)¶ Retrieves image timestamp related to dai::Clock::now()
-
ImgFrame &
setTimestampDevice
(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> timestamp)¶ Sets image timestamp related to dai::Clock::now()
-
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 heightwidth
: frame width
-
ImgFrame &
setSize
(std::tuple<unsigned int, unsigned int> size)¶ Specifies frame size
- Parameters
size
: frame size
-
ImgFrame &
setFrame
(cv::Mat frame)¶ Copies cv::Mat data to
ImgFrame buffer- Note
This API only available if OpenCV support is enabled
- Parameters
frame
: Input cv::Mat frame from which to copy the data
-
cv::Mat
getFrame
(bool copy = false)¶ Retrieves data as cv::Mat with specified width, height and type
- Note
This API only available if OpenCV support is enabled
- Return
cv::Mat with corresponding to ImgFrame parameters
- Parameters
copy
: If false only a reference to data is made, otherwise a copy
-
cv::Mat
getCvFrame
()¶ Retrieves cv::Mat suitable for use in common opencv functions.
ImgFrame is converted to color BGR interleaved or grayscale depending on type.- Note
This API only available if OpenCV support is enabled
A copy is always made
- Return
cv::Mat for use in opencv functions
-
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
Private Members
-
RawImgFrame &
img
¶
-
using