Buffer

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

Reference

class depthai.Buffer

Base message - buffer of binary data

getData(self: object) → numpy.ndarray[numpy.uint8]

Get non-owning reference to internal buffer

Returns

Reference to internal buffer

getRaw(self: depthai.ADatatype)depthai.RawBuffer
getSequenceNum(self: depthai.Buffer)int

Retrieves sequence number

getTimestamp(self: depthai.Buffer)datetime.timedelta

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

getTimestampDevice(self: depthai.Buffer)datetime.timedelta

Retrieves timestamp directly captured from device’s monotonic clock, not synchronized to host time. Used mostly for debugging

setData(*args, **kwargs)

Overloaded function.

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

Parameter data:

Copies data to internal buffer

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

Parameter data:

Copies data to internal buffer

setSequenceNum(self: depthai.Buffer, arg0: int)depthai.Buffer

Retrieves sequence number

setTimestamp(self: depthai.Buffer, arg0: datetime.timedelta)depthai.Buffer

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

setTimestampDevice(self: depthai.Buffer, arg0: datetime.timedelta)depthai.Buffer

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

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::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.