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

pub trait BufferTrait {
    pub fn as_raw_Buffer(&self) -> *const c_void;
pub fn as_raw_mut_Buffer(&mut self) -> *mut c_void; pub fn create(
        &mut self,
        arows: i32,
        acols: i32,
        atype: i32,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... }
pub fn create_1(
        &mut self,
        asize: Size,
        atype: i32,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... }
pub fn release(&mut self) -> Result<()> { ... }
pub fn set_auto_release(&mut self, flag: bool) -> Result<()> { ... }
pub fn copy_from(
        &mut self,
        arr: &dyn ToInputArray,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... }
pub fn copy_from_1(
        &mut self,
        arr: &dyn ToInputArray,
        stream: &mut Stream,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<()> { ... }
pub fn copy_to(&self, arr: &mut dyn ToOutputArray) -> Result<()> { ... }
pub fn copy_to_1(
        &self,
        arr: &mut dyn ToOutputArray,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn clone(
        &self,
        target: Buffer_Target,
        auto_release: bool
    ) -> Result<Buffer> { ... }
pub fn bind(&self, target: Buffer_Target) -> Result<()> { ... }
pub fn map_host(&mut self, access: Buffer_Access) -> Result<Mat> { ... }
pub fn unmap_host(&mut self) -> Result<()> { ... }
pub fn map_device(&mut self) -> Result<GpuMat> { ... }
pub fn unmap_device(&mut self) -> Result<()> { ... }
pub fn map_device_1(&mut self, stream: &mut Stream) -> Result<GpuMat> { ... }
pub fn unmap_device_1(&mut self, stream: &mut Stream) -> Result<()> { ... }
pub fn rows(&self) -> Result<i32> { ... }
pub fn cols(&self) -> Result<i32> { ... }
pub fn size(&self) -> Result<Size> { ... }
pub fn empty(&self) -> Result<bool> { ... }
pub fn typ(&self) -> Result<i32> { ... }
pub fn depth(&self) -> Result<i32> { ... }
pub fn channels(&self) -> Result<i32> { ... }
pub fn elem_size(&self) -> Result<i32> { ... }
pub fn elem_size1(&self) -> Result<i32> { ... }
pub 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

pub 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

pub 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

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

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

The function will call setAutoRelease(true) .

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

pub 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

pub 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

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

pub 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

pub 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

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

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

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

Unmaps OpenGL buffer.

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

map to device memory (blocking)

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

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

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

Unmaps OpenGL buffer.

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

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

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

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

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

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

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

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

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

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

get OpenGL opject id

Loading content...

Implementors

impl BufferTrait for Buffer[src]

Loading content...