Trait opencv::prelude::BufferTrait

source ·
pub trait BufferTrait: BufferTraitConst {
Show 17 methods // Required method fn as_raw_mut_Buffer(&mut self) -> *mut c_void; // Provided methods fn create( &mut self, arows: i32, acols: i32, atype: i32, target: Buffer_Target, auto_release: bool ) -> Result<()> { ... } fn create_def(&mut self, arows: i32, acols: i32, atype: i32) -> Result<()> { ... } fn create_size( &mut self, asize: Size, atype: i32, target: Buffer_Target, auto_release: bool ) -> Result<()> { ... } fn create_size_def(&mut self, asize: Size, atype: i32) -> Result<()> { ... } fn release(&mut self) -> Result<()> { ... } fn set_auto_release(&mut self, flag: bool) -> Result<()> { ... } fn copy_from( &mut self, arr: &impl ToInputArray, target: Buffer_Target, auto_release: bool ) -> Result<()> { ... } fn copy_from_def(&mut self, arr: &impl ToInputArray) -> Result<()> { ... } fn copy_from_1( &mut self, arr: &impl ToInputArray, stream: &mut impl StreamTrait, target: Buffer_Target, auto_release: bool ) -> Result<()> { ... } fn copy_from_def_1( &mut self, arr: &impl ToInputArray, stream: &mut impl StreamTrait ) -> 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 impl StreamTrait) -> Result<GpuMat> { ... } fn unmap_device_1(&mut self, stream: &mut impl StreamTrait) -> Result<()> { ... }
}
Expand description

Mutable methods for core::Buffer

Required Methods§

Provided Methods§

source

fn create( &mut self, arows: i32, acols: i32, atype: i32, target: Buffer_Target, auto_release: bool ) -> Result<()>

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
source

fn create_def(&mut self, arows: i32, acols: i32, atype: i32) -> Result<()>

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

This alternative version of BufferTrait::create function uses the following default values for its arguments:

  • target: ARRAY_BUFFER
  • auto_release: false
source

fn create_size( &mut self, asize: Size, atype: i32, target: Buffer_Target, auto_release: bool ) -> Result<()>

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
source

fn create_size_def(&mut self, asize: Size, atype: i32) -> Result<()>

@overload

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

This alternative version of BufferTrait::create_size function uses the following default values for its arguments:

  • target: ARRAY_BUFFER
  • auto_release: false
source

fn release(&mut self) -> Result<()>

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

The function will call setAutoRelease(true) .

source

fn set_auto_release(&mut self, flag: bool) -> Result<()>

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

fn copy_from( &mut self, arr: &impl ToInputArray, target: Buffer_Target, auto_release: bool ) -> Result<()>

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
source

fn copy_from_def(&mut self, arr: &impl ToInputArray) -> Result<()>

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

This alternative version of BufferTrait::copy_from function uses the following default values for its arguments:

  • target: ARRAY_BUFFER
  • auto_release: false
source

fn copy_from_1( &mut self, arr: &impl ToInputArray, stream: &mut impl StreamTrait, target: Buffer_Target, auto_release: bool ) -> Result<()>

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
source

fn copy_from_def_1( &mut self, arr: &impl ToInputArray, stream: &mut impl StreamTrait ) -> Result<()>

@overload

§Note

This alternative version of BufferTrait::copy_from function uses the following default values for its arguments:

  • target: ARRAY_BUFFER
  • auto_release: false
source

fn map_host(&mut self, access: Buffer_Access) -> Result<Mat>

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

fn unmap_host(&mut self) -> Result<()>

Unmaps OpenGL buffer.

source

fn map_device(&mut self) -> Result<GpuMat>

map to device memory (blocking)

source

fn unmap_device(&mut self) -> Result<()>

source

fn map_device_1(&mut self, stream: &mut impl StreamTrait) -> Result<GpuMat>

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.

source

fn unmap_device_1(&mut self, stream: &mut impl StreamTrait) -> Result<()>

Unmaps OpenGL buffer.

Object Safety§

This trait is not object safe.

Implementors§