Struct OpenCLExecutionContext

Source
pub struct OpenCLExecutionContext { /* private fields */ }

Implementations§

Source§

impl OpenCLExecutionContext

Source

pub fn default() -> OpenCLExecutionContext

Source

pub fn copy( unnamed: &impl OpenCLExecutionContextTraitConst, ) -> OpenCLExecutionContext

Source

pub fn copy_mut(unnamed: OpenCLExecutionContext) -> OpenCLExecutionContext

Source

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

pub fn get_current_ref() -> Result<OpenCLExecutionContext>

Get OpenCL execution context of current thread (can be empty)

Source

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

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
Source

pub fn create_2( context: &impl ContextTraitConst, device: &impl DeviceTraitConst, ) -> 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
§Overloaded parameters

Trait Implementations§

Source§

impl Boxed for OpenCLExecutionContext

Source§

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

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

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

Return the underlying mutable raw pointer Read more
Source§

impl Debug for OpenCLExecutionContext

Source§

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

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

impl Default for OpenCLExecutionContext

Source§

fn default() -> Self

Forwards to infallible Self::default()

Source§

impl Drop for OpenCLExecutionContext

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl OpenCLExecutionContextTrait for OpenCLExecutionContext

Source§

impl OpenCLExecutionContextTraitConst for OpenCLExecutionContext

Source§

fn as_raw_OpenCLExecutionContext(&self) -> *const c_void

Source§

fn get_context(&self) -> Result<Context>

Get associated ocl::Context
Source§

fn get_device(&self) -> Result<Device>

Get the single default associated ocl::Device
Source§

fn get_queue(&self) -> Result<Queue>

Get the single ocl::Queue that is associated with the ocl::Context and the single default ocl::Device
Source§

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

Source§

fn bind(&self) -> Result<()>

Bind this OpenCL execution context to current thread. Read more
Source§

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>

Creates new execution context with same OpenCV context and device Read more
Source§

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

Source§

impl Send for OpenCLExecutionContext

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<Mat> ModifyInplace for Mat
where Mat: Boxed,

Source§

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 unsafe in a general case as it leads to having non-exclusive mutable access to the internal data, but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.