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
fn as_raw_mut_Buffer(&mut self) -> *mut c_void
Provided Methods
sourcefn create(
&mut self,
arows: i32,
acols: i32,
atype: i32,
target: Buffer_Target,
auto_release: bool
) -> Result<()>
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
sourcefn create_size(
&mut self,
asize: Size,
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<()>
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
sourcefn release(&mut self) -> Result<()>
fn release(&mut self) -> Result<()>
Decrements the reference counter and destroys the buffer object if needed.
The function will call setAutoRelease(true) .
sourcefn set_auto_release(&mut self, flag: bool) -> Result<()>
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).
sourcefn copy_from(
&mut self,
arr: &dyn ToInputArray,
target: Buffer_Target,
auto_release: bool
) -> Result<()>
fn copy_from(
&mut self,
arr: &dyn 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
sourcefn copy_from_1(
&mut self,
arr: &dyn ToInputArray,
stream: &mut Stream,
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<()>
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
sourcefn map_host(&mut self, access: Buffer_Access) -> Result<Mat>
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 .
sourcefn unmap_host(&mut self) -> Result<()>
fn unmap_host(&mut self) -> Result<()>
Unmaps OpenGL buffer.
sourcefn map_device(&mut self) -> Result<GpuMat>
fn map_device(&mut self) -> Result<GpuMat>
map to device memory (blocking)
fn unmap_device(&mut self) -> Result<()>
sourcefn map_device_1(&mut self, stream: &mut Stream) -> Result<GpuMat>
fn map_device_1(&mut self, stream: &mut Stream) -> 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.
sourcefn unmap_device_1(&mut self, stream: &mut Stream) -> Result<()>
fn unmap_device_1(&mut self, stream: &mut Stream) -> Result<()>
Unmaps OpenGL buffer.