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