| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
cv::MediaFrame Class Reference
Gapi_data_structures

cv::MediaFrame class represents an image/media frame obtained from an external source. More...

`#include <opencv2/gapi/media.hpp>`

Collaboration diagram for cv::MediaFrame:

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

## Detailed Description

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

See also
  cv::RMat

## Member Typedef Documentation

## ◆ AdapterPtr

using cv::MediaFrame::AdapterPtr = std::unique_ptr<IAdapter>

## Member Enumeration Documentation

## ◆ Access

enum class cv::MediaFrame::Access
| 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.

## Constructor & Destructor Documentation

## ◆ MediaFrame() [1/2]

cv::MediaFrame::MediaFrame | ( |  | ) |

Constructs an empty MediaFrame.

The constructed object has no any data associated with it.

## ◆ MediaFrame() [2/2]

cv::MediaFrame::MediaFrame | ( | AdapterPtr && | p | ) |
| explicit

Constructs a MediaFrame with the given Adapter. MediaFrame takes ownership over the passed adapter.

Parameters

  p | an unique pointer to instance of IAdapter derived class.

## Member Function Documentation

## ◆ access()

View cv::MediaFrame::access | ( | Access | mode | ) | const

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

Parameters

  mode | an access mode flag

Returns
  a MediaFrame::View object. The views should be handled carefully, refer to the MediaFrame::View documentation for details.

## ◆ desc()

cv::GFrameDesc cv::MediaFrame::desc | ( |  | ) | const

Returns a media frame descriptor – the information about the media format, dimensions, etc.

Returns
  a cv::GFrameDesc

## ◆ get()

template<typename T >

T * cv::MediaFrame::get | ( |  | ) | const
| 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().

Returns
  a pointer to the adapter object, nullptr if the adapter type is different.

## ◆ serialize()

void cv::MediaFrame::serialize | ( | cv::gapi::s11n::IOStream & | os | ) | const

Serialize MediaFrame's data to a byte array.

Note
  The actual logic is implemented by frame's adapter class. Does nothing by default.

Parameters

  os | Bytestream to store serialized MediaFrame data in.

The documentation for this class was generated from the following file:

- opencv2/gapi/media.hpp