Пример #1
0
 /// <summary>
 /// Release the unmanaged memory associated with this object
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         OclInvoke.oclKernelArgRelease(ref _ptr);
     }
 }
Пример #2
0
 /// <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));
         }
 }
Пример #3
0
 /// <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);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Create a empty OclContext object
 /// </summary>
 public Context()
     : this(OclInvoke.oclContextCreate(), true)
 {
 }
Пример #5
0
 /// <summary>
 /// Create a empty OclProgram object
 /// </summary>
 public Program()
     : this(OclInvoke.oclProgramCreate())
 {
 }
Пример #6
0
 /// <summary>
 /// Release the unmanaged memory associated with this object
 /// </summary>
 protected override void DisposeObject()
 {
     OclInvoke.oclProgramSourceRelease(ref _ptr);
     _programSource.Dispose();
 }
Пример #7
0
 /// <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);
 }
Пример #8
0
 /// <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));
 }
Пример #9
0
 /// <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));
 }
Пример #10
0
 /// <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);
 }
Пример #11
0
 /// <summary>
 /// Wait for the queue to finish
 /// </summary>
 public void Finish()
 {
     OclInvoke.oclQueueFinish(_ptr);
 }
Пример #12
0
 /// <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));
 }
Пример #13
0
 /// <summary>
 /// Create an opencl kernel
 /// </summary>
 public Kernel()
 {
     _ptr = OclInvoke.oclKernelCreateDefault();
 }
Пример #14
0
 /// <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));
 }
Пример #15
0
 /// <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));
 }
Пример #16
0
 /// <summary>
 /// Set the native device pointer
 /// </summary>
 /// <param name="nativeDevicePointer"></param>
 public void Set(IntPtr nativeDevicePointer)
 {
     OclInvoke.oclDeviceSet(_ptr, nativeDevicePointer);
 }
Пример #17
0
 /// <summary>
 /// Create a empty OclDevice object
 /// </summary>
 public Device()
     : this(OclInvoke.oclDeviceCreate(), true)
 {
 }
Пример #18
0
 /// <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);
 }
Пример #19
0
 /// <summary>
 /// OpenCL queue
 /// </summary>
 public Queue()
 {
     _ptr = OclInvoke.oclQueueCreate();
 }
Пример #20
0
 /// <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));
 }
Пример #21
0
 /// <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);
 }
Пример #22
0
 /// <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));
 }