/// <summary> /// Release the unmanaged memory associated with this object /// </summary> protected override void DisposeObject() { if (_ptr != IntPtr.Zero) { OclInvoke.oclKernelArgRelease(ref _ptr); } }
/// <summary> /// Create an opencl kernel /// </summary> /// <param name="kernelName">The name of the kernel</param> /// <param name="programSource">The program source code</param> /// <param name="buildOps">The build options</param> /// <param name="errMsg">Option error message container that can be passed to this function</param> /// <returns>True if the kernel can be created</returns> public bool Create(String kernelName, ProgramSource programSource, String buildOps = null, CvString errMsg = null) { using (CvString cs = new CvString(kernelName)) using (CvString buildOptStr = new CvString(buildOps)) { return(OclInvoke.oclKernelCreate(_ptr, cs, programSource, buildOptStr, errMsg)); } }
/// <summary> /// Release all the unmanaged memory associated with this OclContext /// </summary> protected override void DisposeObject() { if (_needDispose) { if (_ptr != IntPtr.Zero) { OclInvoke.oclContextRelease(ref _ptr); } } }
/// <summary> /// Create a empty OclContext object /// </summary> public Context() : this(OclInvoke.oclContextCreate(), true) { }
/// <summary> /// Create a empty OclProgram object /// </summary> public Program() : this(OclInvoke.oclProgramCreate()) { }
/// <summary> /// Release the unmanaged memory associated with this object /// </summary> protected override void DisposeObject() { OclInvoke.oclProgramSourceRelease(ref _ptr); _programSource.Dispose(); }
/// <summary> /// Create OpenCL program source code /// </summary> /// <param name="source">The source code</param> public ProgramSource(String source) { _programSource = new CvString(source); _ptr = OclInvoke.oclProgramSourceCreate(_programSource); }
/// <summary> /// Set the parameters for the kernel /// </summary> /// <param name="i">The index of the parameter</param> /// <param name="value">The value</param> /// <returns>The next index value to be set</returns> public int Set(int i, ref float value) { return(OclInvoke.oclKernelSetFloat(_ptr, i, ref value, _sizeOfFloat)); }
/// <summary> /// Set the parameters for the kernel /// </summary> /// <param name="i">The index of the parameter</param> /// <param name="value">The value</param> /// <returns>The next index value to be set</returns> public int Set(int i, ref int value) { return(OclInvoke.oclKernelSetInt(_ptr, i, ref value, _sizeOfInt)); }
/// <summary> /// Create the OCL kernel arg /// </summary> /// <param name="flags">The flags</param> /// <param name="m">The UMat</param> /// <param name="wscale">wscale</param> /// <param name="iwscale">iwscale</param> /// <param name="obj">obj</param> /// <param name="sz">sz</param> public KernelArg(Flags flags, UMat m, int wscale = 1, int iwscale = 1, IntPtr obj = new IntPtr(), IntPtr sz = new IntPtr()) { _ptr = OclInvoke.oclKernelArgCreate(flags, m, wscale, iwscale, obj, sz); }
/// <summary> /// Wait for the queue to finish /// </summary> public void Finish() { OclInvoke.oclQueueFinish(_ptr); }
/// <summary> /// Set the parameters for the kernel /// </summary> /// <param name="i">The index of the parameter</param> /// <param name="data">The data</param> /// <param name="size">The size of the data in number of bytes</param> /// <returns>The next index value to be set</returns> public int Set(int i, IntPtr data, int size) { return(OclInvoke.oclKernelSet(_ptr, i, data, size)); }
/// <summary> /// Create an opencl kernel /// </summary> public Kernel() { _ptr = OclInvoke.oclKernelCreateDefault(); }
/// <summary> /// Set the parameters for the kernel /// </summary> /// <param name="i">The index of the parameter</param> /// <param name="kernelArg">The kernel arg</param> /// <returns>The next index value to be set</returns> public int Set(int i, KernelArg kernelArg) { return(OclInvoke.oclKernelSetKernelArg(_ptr, i, kernelArg)); }
/// <summary> /// Set the parameters for the kernel /// </summary> /// <param name="i">The index of the parameter</param> /// <param name="value">The value</param> /// <returns>The next index value to be set</returns> public int Set(int i, ref double value) { return(OclInvoke.oclKernelSetDouble(_ptr, i, ref value, _sizeOfDouble)); }
/// <summary> /// Set the native device pointer /// </summary> /// <param name="nativeDevicePointer"></param> public void Set(IntPtr nativeDevicePointer) { OclInvoke.oclDeviceSet(_ptr, nativeDevicePointer); }
/// <summary> /// Create a empty OclDevice object /// </summary> public Device() : this(OclInvoke.oclDeviceCreate(), true) { }
/// <summary> /// Get all the platform info as a vector /// </summary> /// <returns>The vector of Platfom info</returns> public static Util.VectorOfOclPlatformInfo GetPlatformsInfo() { Util.VectorOfOclPlatformInfo result = new Util.VectorOfOclPlatformInfo(); OclInvoke.oclGetPlatformsInfo(result); return(result); }
/// <summary> /// OpenCL queue /// </summary> public Queue() { _ptr = OclInvoke.oclQueueCreate(); }
/// <summary> /// Set the parameters for the kernel /// </summary> /// <param name="i">The index of the parameter</param> /// <param name="image2d">The ocl image</param> /// <returns>The next index value to be set</returns> public int Set(int i, Image2D image2d) { return(OclInvoke.oclKernelSetImage2D(_ptr, i, image2d)); }
/// <summary> /// Create an OclImage2D object from UMat /// </summary> /// <param name="src">The UMat from which to get image properties and data</param> /// <param name="norm">Flag to enable the use of normalized channel data types</param> /// <param name="alias">Flag indicating that the image should alias the src UMat. If true, changes to the image or src will be reflected in both objects.</param> public Image2D(UMat src, bool norm = false, bool alias = false) { _ptr = OclInvoke.oclImage2DFromUMat(src, norm, alias); }
/// <summary> /// Set the parameters for the kernel /// </summary> /// <param name="i">The index of the parameter</param> /// <param name="umat">The umat</param> /// <returns>The next index value to be set</returns> public int Set(int i, UMat umat) { return(OclInvoke.oclKernelSetUMat(_ptr, i, umat)); }