$darkmode
![]() |
OpenCV 4.11.0
Open Source Computer Vision
|
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 |
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.
using cv::MediaFrame::View::Callback = std::function<void()> |
using cv::MediaFrame::View::Ptrs = std::array<void*, MAX_PLANES> |
using cv::MediaFrame::View::Strides = std::array<std::size_t, MAX_PLANES> |
cv::MediaFrame::View::~View | ( | ) |
|
staticconstexpr |
Ptrs cv::MediaFrame::View::ptr |
Array of image plane pointers.
Strides cv::MediaFrame::View::stride |
Array of image plane strides, in bytes.