OpenCV  4.5.5
Open Source Computer Vision
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
cv::MediaFrame::View Class Referencefinal

Provides access to the MediaFrame's underlying data. More...

#include <opencv2/gapi/media.hpp>

Public Types

using Callback = std::function< void()>
 
using Ptrs = std::array< void *, MAX_PLANES >
 
using Strides = std::array< std::size_t, MAX_PLANES >
 

Public Member Functions

 ~View ()
 

Public Attributes

Ptrs ptr
 Array of image plane pointers. More...
 
Strides stride
 Array of image plane strides, in bytes. More...
 

Static Public Attributes

static constexpr const size_t MAX_PLANES = 4
 

Detailed Description

Provides access to the MediaFrame's underlying data.

This object contains the necessary information to access the pixel data of the associated MediaFrame: arrays of pointers and strides (distance between every plane row, in bytes) for every image plane, as defined in cv::MediaFormat. There may be up to four image planes in MediaFrame.

Depending on the MediaFrame::Access flag passed in MediaFrame::access(), a MediaFrame::View may be read- or write-only.

Depending on the MediaFrame::IAdapter implementation associated with the parent MediaFrame, writing to memory with MediaFrame::Access::R flag may have no effect or lead to undefined behavior. Same applies to reading the memory with MediaFrame::Access::W flag – again, depending on the IAdapter implementation, the host-side buffer the view provides access to may have no current data stored in (so in-place editing of the buffer contents may not be possible).

MediaFrame::View objects must be handled carefully, as an external resource associated with MediaFrame may be locked for the time the MediaFrame::View object exists. Obtaining MediaFrame::View should be seen as "map" and destroying it as "unmap" in the "map/unmap" idiom (applicable to OpenCL, device memory, remote memory).

When a MediaFrame buffer is accessed for writing, and the memory under MediaFrame::View::Ptrs is altered, the data synchronization of a host-side and device/remote buffer is not guaranteed until the MediaFrame::View is destroyed. In other words, the real data on the device or in a remote target may be updated at the MediaFrame::View destruction only – but it depends on the associated MediaFrame::IAdapter implementation.

Member Typedef Documentation

◆ Callback

using cv::MediaFrame::View::Callback = std::function<void()>

◆ Ptrs

using cv::MediaFrame::View::Ptrs = std::array<void*, MAX_PLANES>

◆ Strides

using cv::MediaFrame::View::Strides = std::array<std::size_t, MAX_PLANES>

Constructor & Destructor Documentation

◆ ~View()

cv::MediaFrame::View::~View ( )

Member Data Documentation

◆ MAX_PLANES

constexpr const size_t cv::MediaFrame::View::MAX_PLANES = 4
static

◆ ptr

Ptrs cv::MediaFrame::View::ptr

Array of image plane pointers.

◆ stride

Strides cv::MediaFrame::View::stride

Array of image plane strides, in bytes.


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