OpenCV 5.0.0-pre
Open Source Computer Vision
|
cv::MediaFrame class represents an image/media frame obtained from an external source. More...
#include <opencv2/gapi/media.hpp>
Classes | |
class | IAdapter |
An interface class for MediaFrame data adapters. More... | |
class | View |
Provides access to the MediaFrame's underlying data. More... | |
Public Types | |
enum class | Access { R , W } |
using | AdapterPtr = std::unique_ptr<IAdapter> |
Public Member Functions | |
MediaFrame () | |
Constructs an empty MediaFrame. | |
MediaFrame (AdapterPtr &&p) | |
Constructs a MediaFrame with the given Adapter. MediaFrame takes ownership over the passed adapter. | |
View | access (Access mode) const |
Obtain access to the underlying data with the given mode. | |
cv::GFrameDesc | desc () const |
Returns a media frame descriptor – the information about the media format, dimensions, etc. | |
template<typename T > | |
T * | get () const |
Casts and returns the associated MediaFrame adapter to the particular adapter type T , returns nullptr if the type is different. | |
void | serialize (cv::gapi::s11n::IOStream &os) const |
Serialize MediaFrame's data to a byte array. | |
Static Public Member Functions | |
template<class T , class... Args> | |
static cv::MediaFrame | Create (Args &&... args) |
Constructs a MediaFrame with the given parameters for the Adapter. The adapter of type T is costructed on the fly. | |
cv::MediaFrame class represents an image/media frame obtained from an external source.
cv::MediaFrame represents image data as specified in cv::MediaFormat. cv::MediaFrame is designed to be a thin wrapper over some external memory of buffer; the class itself provides an uniform interface over such types of memory. cv::MediaFrame wraps data from a camera driver or from a media codec and provides an abstraction layer over this memory to G-API. MediaFrame defines a compact interface to access and manage the underlying data; the implementation is fully defined by the associated Adapter (which is usually user-defined).
using cv::MediaFrame::AdapterPtr = std::unique_ptr<IAdapter> |
|
strong |
This enum defines different types of cv::MediaFrame provided access to the underlying data. Note that different flags can't be combined in this version.
Enumerator | |
---|---|
R | Access data for reading. |
W | Access data for writing. |
cv::MediaFrame::MediaFrame | ( | ) |
Constructs an empty MediaFrame.
The constructed object has no any data associated with it.
|
explicit |
Constructs a MediaFrame with the given Adapter. MediaFrame takes ownership over the passed adapter.
p | an unique pointer to instance of IAdapter derived class. |
Obtain access to the underlying data with the given mode.
Depending on the associated Adapter and the data wrapped, this method may be cheap (e.g., the underlying memory is local) or costly (if the underlying memory is external or device memory).
mode | an access mode flag |
cv::GFrameDesc cv::MediaFrame::desc | ( | ) | const |
Returns a media frame descriptor – the information about the media format, dimensions, etc.
|
inline |
Casts and returns the associated MediaFrame adapter to the particular adapter type T
, returns nullptr if the type is different.
This method may be useful if the adapter type is known by the caller, and some lower level access to the memory is required. Depending on the memory type, it may be more efficient than access().
void cv::MediaFrame::serialize | ( | cv::gapi::s11n::IOStream & | os | ) | const |
Serialize MediaFrame's data to a byte array.
os | Bytestream to store serialized MediaFrame data in. |