Syntalos::Frame

Syntalos::Frame

Syntalos::Frame

A single frame of a video stream. More…

#include <frametype.h>

Inherits from Syntalos::BaseDataType

Public Functions

Name
Frame()
Frame(const cv::Mat & imgMat, const microseconds_t & t)
Frame(const cv::Mat & imgMat, const uint64_t & idx, const microseconds_t & t)
Frame(const uint64_t & idx)
cv::MatcopyMat() const
virtual ssize_tmemorySize() const override
Calculate the size of the data in memory.
virtual boolwriteToMemory(void * memory, ssize_t size =-1) const override
Write the data to a memory block.
virtual booltoBytes(ByteVector & output) const override
Serialize the data to a byte array.
FramefromMemory(const void * buffer, size_t size)
voidfromMemoryInto(const void * buffer, size_t size, Frame & frame)
Deserialize a Frame from buffer into frame, reusing its cv::Mat pixel buffer when possible.

Public Attributes

Name
uint64_tindex
microseconds_ttime
cv::Matmat

Additional inherited members

Public Types inherited from Syntalos::BaseDataType

Name
enumTypeId { Unknown, ControlCommand, TableRow, Frame, FirmataControl, FirmataData, IntSignalBlock, FloatSignalBlock, Last}
The TypeId enum.

Public Functions inherited from Syntalos::BaseDataType

Name
virtual~BaseDataType() =default
virtual TypeIdtypeId() const =0
std::stringtypeIdToString(int value)
std::stringtypeIdToString(TypeId value)
TypeIdtypeIdFromString(const std::string & str)

Detailed Description

struct Syntalos::Frame;

A single frame of a video stream.

Describes a single frame in a stream of frames that make up a complete video. Each frame is timestamped with the exact time of its acquisition.

Public Functions Documentation

function Frame

inline explicit Frame()

function Frame

inline explicit Frame(
    const cv::Mat & imgMat,
    const microseconds_t & t
)

function Frame

inline explicit Frame(
    const cv::Mat & imgMat,
    const uint64_t & idx,
    const microseconds_t & t
)

function Frame

inline explicit Frame(
    const uint64_t & idx
)

function copyMat

inline cv::Mat copyMat() const

function memorySize

inline virtual ssize_t memorySize() const override

Calculate the size of the data in memory.

Reimplements: Syntalos::BaseDataType::memorySize

Quickly calculate the maximum size this data occupies in memory. This will be used to allocate appropriate shared memory blocks in advance. Return -1 if the size is unknown.

function writeToMemory

inline virtual bool writeToMemory(
    void * memory,
    ssize_t size =-1
) const override

Write the data to a memory block.

Reimplements: Syntalos::BaseDataType::writeToMemory

Write the data to a memory block. The required size of the block is given by the memorySize() method, but a larger size can be passed if needed.

Return true if the data was written successfully.

function toBytes

inline virtual bool toBytes(
    ByteVector & output
) const override

Serialize the data to a byte array.

Reimplements: Syntalos::BaseDataType::toBytes

Serialize the data to a byte array for local transmission.

function fromMemory

static inline Frame fromMemory(
    const void * buffer,
    size_t size
)

function fromMemoryInto

static inline void fromMemoryInto(
    const void * buffer,
    size_t size,
    Frame & frame
)

Deserialize a Frame from buffer into frame, reusing its cv::Mat pixel buffer when possible.

Unlike fromMemory(), this variant avoids a malloc/free pair on every call when the frame dimensions and type are unchanged between calls AND frame is the exclusive owner of its mat data (cv::Mat refcount == 1).

If the buffer is shared with subscriber queues (refcount > 1) the old data is released safely - each subscriber still holds its own reference

  • and a fresh allocation is made for this frame.

Public Attributes Documentation

variable index

uint64_t index;

variable time

microseconds_t time;

variable mat

cv::Mat mat;

Updated on 2026-03-16 at 19:16:01 +0000