Struct opencv::core::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 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
source§

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

§

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>,

§

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.