Trait opencv::core::BufferTrait

source ·
pub trait BufferTrait: BufferTraitConst {
Show 13 methods fn as_raw_mut_Buffer(&mut self) -> *mut c_void; fn create(
        &mut self,
        arows: i32,
        acols: i32,
        atype: i32,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... } fn create_size(
        &mut self,
        asize: Size,
        atype: i32,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... } fn release(&mut self) -> Result<()> { ... } fn set_auto_release(&mut self, flag: bool) -> Result<()> { ... } fn copy_from(
        &mut self,
        arr: &dyn ToInputArray,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... } fn copy_from_1(
        &mut self,
        arr: &dyn ToInputArray,
        stream: &mut Stream,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... } fn map_host(&mut self, access: Buffer_Access) -> Result<Mat> { ... } fn unmap_host(&mut self) -> Result<()> { ... } fn map_device(&mut self) -> Result<GpuMat> { ... } fn unmap_device(&mut self) -> Result<()> { ... } fn map_device_1(&mut self, stream: &mut Stream) -> Result<GpuMat> { ... } fn unmap_device_1(&mut self, stream: &mut Stream) -> Result<()> { ... }
}

Required Methods

Provided Methods

Allocates memory for ogl::Buffer object.

Parameters
  • arows: Number of rows in a 2D array.
  • acols: Number of columns in a 2D array.
  • atype: Array type ( CV_8UC1, …, CV_64FC4 ). See Mat for details.
  • target: Buffer usage. See cv::ogl::Buffer::Target .
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
C++ default parameters
  • target: ARRAY_BUFFER
  • auto_release: false

Allocates memory for ogl::Buffer object.

Parameters
  • arows: Number of rows in a 2D array.
  • acols: Number of columns in a 2D array.
  • atype: Array type ( CV_8UC1, …, CV_64FC4 ). See Mat for details.
  • target: Buffer usage. See cv::ogl::Buffer::Target .
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
Overloaded parameters
  • asize: 2D array size.
  • atype: Array type ( CV_8UC1, …, CV_64FC4 ). See Mat for details.
  • target: Buffer usage. See cv::ogl::Buffer::Target .
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
C++ default parameters
  • target: ARRAY_BUFFER
  • auto_release: false

Decrements the reference counter and destroys the buffer object if needed.

The function will call setAutoRelease(true) .

Sets auto release mode.

The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was bound to a window it could be released at any time (user can close a window). If object’s destructor is called after destruction of the context it will cause an error. Thus ogl::Buffer doesn’t destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context). This function can force ogl::Buffer destructor to destroy OpenGL object.

Parameters
  • flag: Auto release mode (if true, release will be called in object’s destructor).

Copies from host/device memory to OpenGL buffer.

Parameters
  • arr: Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ).
  • target: Buffer usage. See cv::ogl::Buffer::Target .
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
C++ default parameters
  • target: ARRAY_BUFFER
  • auto_release: false

Copies from host/device memory to OpenGL buffer.

Parameters
  • arr: Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ).
  • target: Buffer usage. See cv::ogl::Buffer::Target .
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
Overloaded parameters
C++ default parameters
  • target: ARRAY_BUFFER
  • auto_release: false

Maps OpenGL buffer to host memory.

mapHost maps to the client’s address space the entire data store of the buffer object. The data can then be directly read and/or written relative to the returned pointer, depending on the specified access policy.

A mapped data store must be unmapped with ogl::Buffer::unmapHost before its buffer object is used.

This operation can lead to memory transfers between host and device.

Only one buffer object can be mapped at a time.

Parameters
  • access: Access policy, indicating whether it will be possible to read from, write to, or both read from and write to the buffer object’s mapped data store. The symbolic constant must be ogl::Buffer::READ_ONLY , ogl::Buffer::WRITE_ONLY or ogl::Buffer::READ_WRITE .

Unmaps OpenGL buffer.

map to device memory (blocking)

Maps OpenGL buffer to CUDA device memory.

This operation doesn’t copy data. Several buffer objects can be mapped to CUDA memory at a time.

A mapped data store must be unmapped with ogl::Buffer::unmapDevice before its buffer object is used.

Unmaps OpenGL buffer.

Implementors