[][src]Trait opencv::core::BufferTrait

pub trait BufferTrait {
    fn as_raw_Buffer(&self) -> *const c_void;
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_1(
        &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 copy_to(&self, arr: &mut dyn ToOutputArray) -> Result<()> { ... }
fn copy_to_1(
        &self,
        arr: &mut dyn ToOutputArray,
        stream: &mut Stream
    ) -> Result<()> { ... }
fn clone(&self, target: Buffer_Target, auto_release: bool) -> Result<Buffer> { ... }
fn bind(&self, target: Buffer_Target) -> 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<()> { ... }
fn rows(&self) -> Result<i32> { ... }
fn cols(&self) -> Result<i32> { ... }
fn size(&self) -> Result<Size> { ... }
fn empty(&self) -> Result<bool> { ... }
fn typ(&self) -> Result<i32> { ... }
fn depth(&self) -> Result<i32> { ... }
fn channels(&self) -> Result<i32> { ... }
fn elem_size(&self) -> Result<i32> { ... }
fn elem_size1(&self) -> Result<i32> { ... }
fn buf_id(&self) -> Result<u32> { ... } }

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.

Required methods

Loading content...

Provided methods

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

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

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

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

fn release(&mut self) -> Result<()>[src]

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

The function will call setAutoRelease(true) .

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

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

fn copy_from(
    &mut self,
    arr: &dyn ToInputArray,
    target: Buffer_Target,
    auto_release: bool
) -> Result<()>
[src]

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

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

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

fn copy_to(&self, arr: &mut dyn ToOutputArray) -> Result<()>[src]

Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.

Parameters

  • arr: Destination array (host or device memory, can be Mat , cuda::GpuMat , std::vector or ogl::Buffer ).

fn copy_to_1(
    &self,
    arr: &mut dyn ToOutputArray,
    stream: &mut Stream
) -> Result<()>
[src]

Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.

Parameters

  • arr: Destination array (host or device memory, can be Mat , cuda::GpuMat , std::vector or ogl::Buffer ).

Overloaded parameters

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

Creates a full copy of the buffer object and the underlying data.

Parameters

  • target: Buffer usage for destination buffer.
  • autoRelease: Auto release mode for destination buffer.

C++ default parameters

  • target: ARRAY_BUFFER
  • auto_release: false

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

Binds OpenGL buffer to the specified buffer binding point.

Parameters

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

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

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 .

fn unmap_host(&mut self) -> Result<()>[src]

Unmaps OpenGL buffer.

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

map to device memory (blocking)

fn unmap_device(&mut self) -> Result<()>[src]

fn map_device_1(&mut self, stream: &mut Stream) -> Result<GpuMat>[src]

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.

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

Unmaps OpenGL buffer.

fn rows(&self) -> Result<i32>[src]

fn cols(&self) -> Result<i32>[src]

fn size(&self) -> Result<Size>[src]

fn empty(&self) -> Result<bool>[src]

fn typ(&self) -> Result<i32>[src]

fn depth(&self) -> Result<i32>[src]

fn channels(&self) -> Result<i32>[src]

fn elem_size(&self) -> Result<i32>[src]

fn elem_size1(&self) -> Result<i32>[src]

fn buf_id(&self) -> Result<u32>[src]

get OpenGL opject id

Loading content...

Implementors

impl BufferTrait for Buffer[src]

Loading content...