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
-
getCvFrame
(self: object) → object Returns BGR or grayscale frame compatible with use in other opencv functions
-
getData
(self: object) → numpy.ndarray[numpy.uint8] - Returns
Reference to internal buffer
-
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
-
getRaw
(self: depthai.ADatatype) → depthai.RawBuffer
-
getSequenceNum
(self: depthai.ImgFrame) → int Retrieves image sequence number
-
getTimestamp
(self: depthai.ImgFrame) → datetime.timedelta Retrieves image timestamp related to steady_clock / time.monotonic
-
getTimestampDevice
(self: depthai.ImgFrame) → datetime.timedelta Retrieves image timestamp directly captured from device’s monotonic clock, not synchronized to host time. Used mostly for debugging
-
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) → None - 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) → None Specifies frame height
- Parameter
height
: frame height
- Parameter
-
setInstanceNum
(self: depthai.ImgFrame, instance: int) → None Instance number relates to the origin of the frame (which camera)
- Parameter
instance
: Instance number
- Parameter
-
setSequenceNum
(self: depthai.ImgFrame, seq: int) → None Specifies sequence number
- Parameter
seq
: Sequence number
- Parameter
-
setSize
(*args, **kwargs) Overloaded function.
setSize(self: depthai.ImgFrame, width: int, height: int) -> None
Specifies frame size
- Parameter
height
: frame height
- Parameter
width
: frame width
setSize(self: depthai.ImgFrame, sizer: Tuple[int, int]) -> None
Specifies frame size
- Parameter
size
: frame size
-
setTimestamp
(self: depthai.ImgFrame, timestamp: datetime.timedelta) → None Specifies current timestamp, related to steady_clock / time.monotonic
-
setType
(self: depthai.ImgFrame, type: depthai.RawImgFrame.Type) → None Specifies frame type, RGB, BGR, …
- Parameter
type
: Type of image
- Parameter
-
setWidth
(self: depthai.ImgFrame, width: int) → None Specifies frame width
- Parameter
width
: frame width
- Parameter
-
class
-
class
dai
::
ImgFrame
: public dai::Buffer¶ ImgFrame message. Carries image data and metadata.
Public Functions
-
~ImgFrame
() = default¶
-
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration>
getTimestamp
() const¶ Retrieves image timestamp related to steady_clock / time.monotonic
-
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration>
getTimestampDevice
() const¶ Retrieves image timestamp directly captured from device’s monotonic clock, not synchronized to host time. Used mostly for debugging
-
unsigned int
getInstanceNum
() const¶ Retrieves instance number
-
unsigned int
getCategory
() const¶ Retrieves image category
-
unsigned int
getSequenceNum
() const¶ Retrieves image sequence number
-
unsigned int
getWidth
() const¶ Retrieves image width in pixels
-
unsigned int
getHeight
() const¶ Retrieves image height in pixels
-
void
setTimestamp
(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> timestamp)¶ Specifies current timestamp, related to steady_clock / time.monotonic
-
void
setInstanceNum
(unsigned int instance)¶ Instance number relates to the origin of the frame (which camera)
- Parameters
instance
: Instance number
-
void
setCategory
(unsigned int category)¶ - Parameters
category
: Image category
-
void
setSequenceNum
(unsigned int seq)¶ Specifies sequence number
- Parameters
seq
: Sequence number
-
void
setWidth
(unsigned int width)¶ Specifies frame width
- Parameters
width
: frame width
-
void
setHeight
(unsigned int height)¶ Specifies frame height
- Parameters
height
: frame height
-
void
setSize
(unsigned int width, unsigned int height)¶ Specifies frame size
- Parameters
height
: frame heightwidth
: frame width
-
void
setSize
(std::tuple<unsigned int, unsigned int> size)¶ Specifies frame size
- Parameters
size
: frame size
-
void
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
Private Members
-
RawImgFrame &
img
¶
-
Got questions?
We’re always happy to help with code or other questions you might have.