Struct opencv::core::Buffer

source ·
pub struct Buffer { /* private fields */ }
Expand description

Smart pointer for OpenGL buffer object with reference counting.

Buffer Objects are OpenGL objects that store an array of unformatted memory allocated by the OpenGL context. These can be used to store vertex data, pixel data retrieved from images or the framebuffer, and a variety of other things.

ogl::Buffer has interface similar with Mat interface and represents 2D array memory.

ogl::Buffer supports memory transfers between host and device and also can be mapped to CUDA memory.

Implementations§

source§

impl Buffer

source

pub fn default() -> Result<Buffer>

The constructors.

Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId parameter), allocates memory for ogl::Buffer object or copies from host/device memory.

source

pub fn new( arows: i32, acols: i32, atype: i32, abuf_id: u32, auto_release: bool ) -> Result<Buffer>

The constructors.

Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId parameter), allocates memory for ogl::Buffer object or copies from host/device memory.

Overloaded parameters
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.
  • abufId: Buffer object name.
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
C++ default parameters
  • auto_release: false
source

pub fn new_def( arows: i32, acols: i32, atype: i32, abuf_id: u32 ) -> Result<Buffer>

@overload

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.
  • abufId: Buffer object name.
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
Note

This alternative version of [new] function uses the following default values for its arguments:

  • auto_release: false
source

pub fn new_1( asize: Size, atype: i32, abuf_id: u32, auto_release: bool ) -> Result<Buffer>

The constructors.

Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId parameter), allocates memory for ogl::Buffer object or copies from host/device memory.

Overloaded parameters
Parameters
  • asize: 2D array size.
  • atype: Array type ( CV_8UC1, …, CV_64FC4 ). See Mat for details.
  • abufId: Buffer object name.
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
C++ default parameters
  • auto_release: false
source

pub fn new_def_1(asize: Size, atype: i32, abuf_id: u32) -> Result<Buffer>

@overload

Parameters
  • asize: 2D array size.
  • atype: Array type ( CV_8UC1, …, CV_64FC4 ). See Mat for details.
  • abufId: Buffer object name.
  • autoRelease: Auto release mode (if true, release will be called in object’s destructor).
Note

This alternative version of [new] function uses the following default values for its arguments:

  • auto_release: false
source

pub fn new_2( arows: i32, acols: i32, atype: i32, target: Buffer_Target, auto_release: bool ) -> Result<Buffer>

The constructors.

Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId parameter), allocates memory for ogl::Buffer object or copies from host/device memory.

Overloaded parameters
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

pub fn new_def_2(arows: i32, acols: i32, atype: i32) -> Result<Buffer>

@overload

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 [new] function uses the following default values for its arguments:

  • target: ARRAY_BUFFER
  • auto_release: false
source

pub fn new_3( asize: Size, atype: i32, target: Buffer_Target, auto_release: bool ) -> Result<Buffer>

The constructors.

Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId parameter), allocates memory for ogl::Buffer object or copies from host/device memory.

Overloaded parameters
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

pub fn new_def_3(asize: Size, atype: i32) -> Result<Buffer>

@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 [new] function uses the following default values for its arguments:

  • target: ARRAY_BUFFER
  • auto_release: false
source

pub fn new_4( arr: &impl ToInputArray, target: Buffer_Target, auto_release: bool ) -> Result<Buffer>

The constructors.

Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId parameter), allocates memory for ogl::Buffer object or copies from host/device memory.

Overloaded parameters
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

pub fn new_def_4(arr: &impl ToInputArray) -> Result<Buffer>

@overload

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 [new] function uses the following default values for its arguments:

  • target: ARRAY_BUFFER
  • auto_release: false
source

pub fn unbind(target: Buffer_Target) -> Result<()>

Unbind any buffers from the specified binding point.

Parameters
  • target: Binding point. See cv::ogl::Buffer::Target .

Trait Implementations§

source§

impl Boxed for Buffer

source§

unsafe fn from_raw(ptr: *mut c_void) -> Self

Wrap the specified raw pointer Read more
source§

fn into_raw(self) -> *mut c_void

Return an the underlying raw pointer while consuming this wrapper. Read more
source§

fn as_raw(&self) -> *const c_void

Return the underlying raw pointer. Read more
source§

fn as_raw_mut(&mut self) -> *mut c_void

Return the underlying mutable raw pointer Read more
source§

impl BufferTrait for Buffer

source§

fn as_raw_mut_Buffer(&mut self) -> *mut c_void

source§

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

Allocates memory for ogl::Buffer object. Read more
source§

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

Allocates memory for ogl::Buffer object. Read more
source§

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

Allocates memory for ogl::Buffer object. Read more
source§

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

@overload Read more
source§

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

Decrements the reference counter and destroys the buffer object if needed. Read more
source§

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

Sets auto release mode. Read more
source§

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

Copies from host/device memory to OpenGL buffer. Read more
source§

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

Copies from host/device memory to OpenGL buffer. Read more
source§

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

Copies from host/device memory to OpenGL buffer. Read more
source§

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

@overload Read more
source§

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

Maps OpenGL buffer to host memory. Read more
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 Stream) -> Result<GpuMat>

Maps OpenGL buffer to CUDA device memory. Read more
source§

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

Unmaps OpenGL buffer.
source§

impl BufferTraitConst for Buffer

source§

fn as_raw_Buffer(&self) -> *const c_void

source§

fn copy_to(&self, arr: &mut impl ToOutputArray) -> Result<()>

Copies from OpenGL buffer to host/device memory or another OpenGL buffer object. Read more
source§

fn copy_to_1( &self, arr: &mut impl ToOutputArray, stream: &mut Stream ) -> Result<()>

Copies from OpenGL buffer to host/device memory or another OpenGL buffer object. Read more
source§

fn clone(&self, target: Buffer_Target, auto_release: bool) -> Result<Buffer>

Creates a full copy of the buffer object and the underlying data. Read more
source§

fn clone_def(&self) -> Result<Buffer>

Creates a full copy of the buffer object and the underlying data. Read more
source§

fn bind(&self, target: Buffer_Target) -> Result<()>

Binds OpenGL buffer to the specified buffer binding point. Read more
source§

fn rows(&self) -> Result<i32>

source§

fn cols(&self) -> Result<i32>

source§

fn size(&self) -> Result<Size>

source§

fn empty(&self) -> Result<bool>

source§

fn typ(&self) -> Result<i32>

source§

fn depth(&self) -> Result<i32>

source§

fn channels(&self) -> Result<i32>

source§

fn elem_size(&self) -> Result<i32>

source§

fn elem_size1(&self) -> Result<i32>

source§

fn buf_id(&self) -> Result<u32>

get OpenGL opject id
source§

impl Debug for Buffer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Buffer

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Buffer

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.