Buffer

Just a good old buffer. All other messages derive from the Buffer class.

Reference

class depthai.Buffer
getData(self: object) → numpy.ndarray[numpy.uint8]
getRaw(self: depthai.ADatatype)depthai.RawBuffer
getSequenceNum(self: depthai.Buffer)int
getTimestamp(self: depthai.Buffer)datetime.timedelta
getTimestampDevice(self: depthai.Buffer)datetime.timedelta
setData(*args, **kwargs)

Overloaded function.

  1. setData(self: depthai.Buffer, arg0: list[int]) -> None

  2. setData(self: depthai.Buffer, arg0: numpy.ndarray[numpy.uint8]) -> None

setSequenceNum(self: depthai.Buffer, arg0: int)depthai.Buffer
setTimestamp(self: depthai.Buffer, arg0: datetime.timedelta)depthai.Buffer
setTimestampDevice(self: depthai.Buffer, arg0: datetime.timedelta)depthai.Buffer
class dai::Buffer : public dai::ADatatype

Base message - buffer of binary data.

Subclassed by dai::AprilTagConfig, dai::AprilTags, dai::CameraControl, dai::EdgeDetectorConfig, dai::EncodedFrame, dai::FeatureTrackerConfig, dai::ImageAlignConfig, dai::ImageManipConfig, dai::ImgDetections, dai::ImgFrame, dai::IMUData, dai::MessageGroup, dai::NNData, dai::PointCloudConfig, dai::PointCloudData, dai::SpatialImgDetections, dai::SpatialLocationCalculatorConfig, dai::SpatialLocationCalculatorData, dai::StereoDepthConfig, dai::SystemInformation, dai::ToFConfig, dai::TrackedFeatures, dai::Tracklets

Public Functions

Buffer()

Creates Buffer message.

Buffer(std::shared_ptr<dai::RawBuffer> ptr)
~Buffer() = default
std::vector<std::uint8_t> &getData() const

Get non-owning reference to internal buffer.

Return

Reference to internal buffer

void setData(const std::vector<std::uint8_t> &data)

Parameters
  • data: Copies data to internal buffer

void setData(std::vector<std::uint8_t> &&data)

Parameters
  • data: Moves data to internal buffer

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

int64_t getSequenceNum() const

Retrieves sequence number

Buffer &setTimestamp(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> timestamp)

Sets timestamp related to dai::Clock::now()

Buffer &setTimestampDevice(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> timestamp)

Sets timestamp related to dai::Clock::now()

Buffer &setSequenceNum(int64_t sequenceNum)

Retrieves sequence number

Private Functions

std::shared_ptr<dai::RawBuffer> serialize() const override

Got questions?

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