Struct opencv::core::OpenCLExecutionContext
source · pub struct OpenCLExecutionContext { /* private fields */ }
Implementations§
source§impl OpenCLExecutionContext
impl OpenCLExecutionContext
pub fn default() -> OpenCLExecutionContext
pub fn copy( unnamed: &impl OpenCLExecutionContextTraitConst ) -> OpenCLExecutionContext
pub fn copy_mut(unnamed: OpenCLExecutionContext) -> OpenCLExecutionContext
sourcepub fn get_current() -> Result<OpenCLExecutionContext>
pub fn get_current() -> Result<OpenCLExecutionContext>
Get OpenCL execution context of current thread.
Initialize OpenCL execution context if it is empty
- create new
- reuse context of the main thread (threadID = 0)
sourcepub fn get_current_ref() -> Result<OpenCLExecutionContext>
pub fn get_current_ref() -> Result<OpenCLExecutionContext>
Get OpenCL execution context of current thread (can be empty)
sourcepub unsafe fn create(
platform_name: &str,
platform_id: *mut c_void,
context: *mut c_void,
device_id: *mut c_void
) -> Result<OpenCLExecutionContext>
pub unsafe fn create( platform_name: &str, platform_id: *mut c_void, context: *mut c_void, device_id: *mut c_void ) -> Result<OpenCLExecutionContext>
Creates OpenCL execution context OpenCV will check if available OpenCL platform has platformName name, then assign context to OpenCV. The deviceID device will be used as target device and a new command queue will be created.
Note: On success, ownership of one reference of the context and device is taken.
The caller should additionally call clRetainContext
and/or clRetainDevice
to increase the reference count if it wishes to continue using them.
§Parameters
- platformName: name of OpenCL platform to attach, this string is used to check if platform is available to OpenCV at runtime
- platformID: ID of platform attached context was created for (cl_platform_id)
- context: OpenCL context to be attached to OpenCV (cl_context)
- deviceID: OpenCL device (cl_device_id)
sourcepub fn create_1(
context: &impl ContextTraitConst,
device: &impl DeviceTraitConst,
queue: &impl QueueTraitConst
) -> Result<OpenCLExecutionContext>
pub fn create_1( context: &impl ContextTraitConst, device: &impl DeviceTraitConst, queue: &impl QueueTraitConst ) -> Result<OpenCLExecutionContext>
Creates OpenCL execution context
§Parameters
- context: non-empty OpenCL context
- device: non-empty OpenCL device (must be a part of context)
- queue: non-empty OpenCL queue for provided context and device
sourcepub fn create_2(
context: &impl ContextTraitConst,
device: &impl DeviceTraitConst
) -> Result<OpenCLExecutionContext>
pub fn create_2( context: &impl ContextTraitConst, device: &impl DeviceTraitConst ) -> Result<OpenCLExecutionContext>
Trait Implementations§
source§impl Boxed for OpenCLExecutionContext
impl Boxed for OpenCLExecutionContext
source§unsafe fn from_raw(
ptr: <OpenCLExecutionContext as OpenCVFromExtern>::ExternReceive
) -> Self
unsafe fn from_raw( ptr: <OpenCLExecutionContext as OpenCVFromExtern>::ExternReceive ) -> Self
Wrap the specified raw pointer Read more
source§fn into_raw(
self
) -> <OpenCLExecutionContext as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw( self ) -> <OpenCLExecutionContext as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying raw pointer while consuming this wrapper. Read more
source§fn as_raw(
&self
) -> <OpenCLExecutionContext as OpenCVTypeExternContainer>::ExternSend
fn as_raw( &self ) -> <OpenCLExecutionContext as OpenCVTypeExternContainer>::ExternSend
Return the underlying raw pointer. Read more
source§fn as_raw_mut(
&mut self
) -> <OpenCLExecutionContext as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self ) -> <OpenCLExecutionContext as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying mutable raw pointer Read more
source§impl Debug for OpenCLExecutionContext
impl Debug for OpenCLExecutionContext
source§impl Default for OpenCLExecutionContext
impl Default for OpenCLExecutionContext
source§impl Drop for OpenCLExecutionContext
impl Drop for OpenCLExecutionContext
source§impl OpenCLExecutionContextTrait for OpenCLExecutionContext
impl OpenCLExecutionContextTrait for OpenCLExecutionContext
fn as_raw_mut_OpenCLExecutionContext(&mut self) -> *mut c_void
fn set(&mut self, unnamed: &impl OpenCLExecutionContextTraitConst)
fn set_1(&mut self, unnamed: OpenCLExecutionContext)
fn set_use_opencl(&mut self, flag: bool) -> Result<()>
fn release(&mut self) -> Result<()>
source§impl OpenCLExecutionContextTraitConst for OpenCLExecutionContext
impl OpenCLExecutionContextTraitConst for OpenCLExecutionContext
fn as_raw_OpenCLExecutionContext(&self) -> *const c_void
source§fn get_context(&self) -> Result<Context>
fn get_context(&self) -> Result<Context>
Get associated ocl::Context
source§fn get_device(&self) -> Result<Device>
fn get_device(&self) -> Result<Device>
Get the single default associated ocl::Device
source§fn get_queue(&self) -> Result<Queue>
fn get_queue(&self) -> Result<Queue>
Get the single ocl::Queue that is associated with the ocl::Context and
the single default ocl::Device
fn use_opencl(&self) -> Result<bool>
source§fn clone_with_new_queue(
&self,
q: &impl QueueTraitConst
) -> Result<OpenCLExecutionContext>
fn clone_with_new_queue( &self, q: &impl QueueTraitConst ) -> Result<OpenCLExecutionContext>
Creates new execution context with same OpenCV context and device Read more
source§fn clone_with_new_queue_1(&self) -> Result<OpenCLExecutionContext>
fn clone_with_new_queue_1(&self) -> Result<OpenCLExecutionContext>
Creates new execution context with same OpenCV context and device Read more
fn empty(&self) -> Result<bool>
impl Send for OpenCLExecutionContext
Auto Trait Implementations§
impl Freeze for OpenCLExecutionContext
impl RefUnwindSafe for OpenCLExecutionContext
impl !Sync for OpenCLExecutionContext
impl Unpin for OpenCLExecutionContext
impl UnwindSafe for OpenCLExecutionContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res ) -> Res
Helper function to call OpenCV functions that allow in-place modification of a
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance
sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold
. Read more