class dlstreamer::Frame#

Overview#

Frame is collection of one or multiple Tensor objects, attributes (media type and format), and optional metadata as container of Dictionary objects. More…

#include <frame.h>

class Frame {
public:
    // typedefs

    typedef std::vector<TensorPtr>::iterator iterator;

    // construction

    Frame();
    Frame(const Frame&);

    // methods

    Frame& operator = (const Frame&);
    virtual MediaType media_type() const = 0;
    virtual Format format() const = 0;
    virtual MemoryType memory_type() const = 0;
    virtual iterator begin() = 0;
    virtual iterator end() = 0;
    virtual TensorPtr tensor(int index = -1) = 0;
    virtual size_t num_tensors() const = 0;
    virtual Metadata& metadata() = 0;
    const Metadata& metadata() const;
    virtual FramePtr parent() const = 0;
    virtual std::vector<FramePtr> regions() const = 0;
};

// direct descendants

class BaseFrame;

Detailed Documentation#

Frame is collection of one or multiple Tensor objects, attributes (media type and format), and optional metadata as container of Dictionary objects.

Methods#

virtual MediaType media_type() const = 0

Returns media type (Tensors, Image, Audio, etc).

virtual Format format() const = 0

Returns format (media type specific) of frame’s data.

virtual MemoryType memory_type() const = 0

Returns memory type used for tensors allocation.

virtual TensorPtr tensor(int index = -1) = 0

Returns tensor by index. If index less than 0 (default is -1), function checks that frame contains only one tensor and returns it, otherwise exception is thrown.

Parameters:

index

Tensor index

virtual size_t num_tensors() const = 0

Returns number tensors in frame.

virtual Metadata& metadata() = 0

Returns metadata object.

const Metadata& metadata() const

Returns metadata object.

virtual FramePtr parent() const = 0

Returns parent frame if this frame was mapped (using MemoryMapper) from another frame or contains sub-region of another frame, otherwise returns nullptr.

virtual std::vector<FramePtr> regions() const = 0

Returns list of regions. Each region typically represents an object detected on frame and may contain own metadata describing region specific attributes.