Beispiel #1
0
 extern static nint vImageMatrixMultiply_ARGB8888(ref vImageBuffer src,
                                                  ref vImageBuffer dest,
                                                  short [] matrix,                // matrix is [4*4],
                                                  int divisor,
                                                  short []?pre_bias,              //Must be an array of 4 int16_t's. NULL is okay.
                                                  int []?post_bias,               //Must be an array of 4 int32_t's. NULL is okay.
                                                  vImageFlags flags);
Beispiel #2
0
        public static vImageError ConvolveMultiKernelARGB8888(ref vImageBuffer src,
                                                              ref vImageBuffer dest,
                                                              IntPtr tempBuffer,
                                                              vImagePixelCount srcOffsetToROI_X,
                                                              vImagePixelCount srcOffsetToROI_Y,
                                                              short [][] kernels,                       // must be 4
                                                              uint kernel_height,
                                                              uint kernel_width,
                                                              int [] divisors,                  // must be 4
                                                              int [] biases,                    // must be 4
                                                              Pixel8888 backgroundColor,
                                                              vImageFlags flags)
        {
            if (kernels is null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(kernels));
            }
            if (divisors is null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(divisors));
            }
            if (biases is null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(biases));
            }
            if (kernels.Length < 4)
            {
                throw new ArgumentException("Must contain at least four elements", "kernels");
            }
            if (divisors.Length < 4)
            {
                throw new ArgumentException("Must contain at least four elements", "divisors");
            }
            if (biases.Length < 4)
            {
                throw new ArgumentException("Must contain at least four elements", "biases");
            }
            unsafe
            {
                fixed(short *f1 = kernels [0])
                {
                    fixed(short *f2 = kernels [1])
                    {
                        fixed(short *f3 = kernels [2])
                        {
                            fixed(short *f4 = kernels [3])
                            {
                                var ptrs = new short * [4];

                                ptrs [0] = f1;
                                ptrs [1] = f2;
                                ptrs [2] = f3;
                                ptrs [3] = f4;
                                return((vImageError)(long)vImageConvolveMultiKernel_ARGB8888(ref src, ref dest, tempBuffer, srcOffsetToROI_X, srcOffsetToROI_Y, ptrs, kernel_height, kernel_width, divisors, biases, backgroundColor, flags));
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
 extern static nint vImageConvolveMultiKernel_ARGBFFFF(ref vImageBuffer src,
                                                       ref vImageBuffer dest,
                                                       IntPtr tempBuffer,
                                                       vImagePixelCount srcOffsetToROI_X,
                                                       vImagePixelCount srcOffsetToROI_Y,
                                                       float * [] kernels,                 //must be 4, defined as 'float*[4]'
                                                       uint kernel_height,
                                                       uint kernel_width,
                                                       float [] biases,                   // must be 4
                                                       PixelFFFF backgroundColor,
                                                       vImageFlags flags);
Beispiel #4
0
 extern static nint vImageConvolveMultiKernel_ARGB8888(ref vImageBuffer src,
                                                       ref vImageBuffer dest,
                                                       IntPtr tempBuffer,
                                                       vImagePixelCount srcOffsetToROI_X,
                                                       vImagePixelCount srcOffsetToROI_Y,
                                                       short * [] kernels,                               // must be 4
                                                       uint kernel_height,
                                                       uint kernel_width,
                                                       int [] divisors,                          // must be 4
                                                       int [] biases,                            // must be 4
                                                       Pixel8888 backgroundColor,
                                                       vImageFlags flags);
Beispiel #5
0
        public static vImageError ConvolveMultiKernelARGBFFFF(ref vImageBuffer src,
                                                              ref vImageBuffer dest,
                                                              IntPtr tempBuffer,
                                                              vImagePixelCount srcOffsetToROI_X,
                                                              vImagePixelCount srcOffsetToROI_Y,
                                                              float [][] kernels,            //must be 4
                                                              uint kernel_height,
                                                              uint kernel_width,
                                                              float [] biases,             // must be 4
                                                              PixelFFFF backgroundColor,
                                                              vImageFlags flags)
        {
            if (kernels == null)
            {
                throw new ArgumentNullException("kernels");
            }
            if (biases == null)
            {
                throw new ArgumentNullException("biases");
            }
            if (kernels.Length < 4)
            {
                throw new ArgumentException("Must contain at least four elements", "kernels");
            }
            if (biases.Length < 4)
            {
                throw new ArgumentException("Must contain at least four elements", "biases");
            }
            unsafe
            {
                fixed(float *f1 = kernels [0])
                {
                    fixed(float *f2 = kernels [1])
                    {
                        fixed(float *f3 = kernels [2])
                        {
                            fixed(float *f4 = kernels [3])
                            {
                                var ptrs = new float * [4];

                                ptrs [0] = f1;
                                ptrs [1] = f2;
                                ptrs [2] = f3;
                                ptrs [3] = f4;
                                return((vImageError)(long)vImageConvolveMultiKernel_ARGBFFFF(ref src, ref dest, tempBuffer, srcOffsetToROI_X, srcOffsetToROI_Y, ptrs, kernel_height, kernel_width, biases, backgroundColor, flags));
                            }
                        }
                    }
                }
            }
        }
Beispiel #6
0
 public static vImageError MatrixMultiplyARGB8888(ref vImageBuffer src,
                                                  ref vImageBuffer dest,
                                                  short [] matrix,           // matrix is [4*4],
                                                  int divisor,
                                                  short [] pre_bias,         //Must be an array of 4 int16_t's. NULL is okay.
                                                  int [] post_bias,          //Must be an array of 4 int32_t's. NULL is okay.
                                                  vImageFlags flags)
 {
     if (matrix is null)
     {
         ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(matrix));
     }
     if (pre_bias is not null && pre_bias.Length != 4)
     {
         throw new ArgumentException("Must have four elements", nameof(pre_bias));
     }
     if (post_bias is not null && post_bias.Length != 4)
     {
         throw new ArgumentException("Must have four elements", nameof(post_bias));
     }
     return((vImageError)(long)vImageMatrixMultiply_ARGB8888(ref src, ref dest, matrix, divisor, pre_bias, post_bias, flags));
 }
Beispiel #7
0
 public static vImageError TentConvolveARGB8888(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint kernel_height, uint kernel_width, Pixel8888 backgroundColor, vImageFlags flags)
 {
     return((vImageError)(long)vImageTentConvolve_ARGB8888(ref src, ref dest, tempBuffer, srcOffsetToROI_X, srcOffsetToROI_Y, kernel_height, kernel_width, backgroundColor, flags));
 }
Beispiel #8
0
 extern static nint vImageTentConvolve_ARGB8888(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint kernel_height, uint kernel_width, Pixel8888 backgroundColor, vImageFlags flags);
Beispiel #9
0
 public static vImageError RichardsonLucyDeConvolveARGBFFFF(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float *kernel, float *kernel2, uint kernel_height, uint kernel_width, uint kernel_height2, uint kernel_width2, PixelFFFF backgroundColor, uint iterationCount, vImageFlags flags)
 {
     return((vImageError)(long)vImageRichardsonLucyDeConvolve_ARGBFFFF(ref src, ref dest, tempBuffer, srcOffsetToROI_X, srcOffsetToROI_Y, kernel, kernel2, kernel_height, kernel_width, kernel_height2, kernel_width2, backgroundColor, iterationCount, flags));
 }
Beispiel #10
0
 extern static nint vImageRichardsonLucyDeConvolve_ARGBFFFF(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float *kernel, float *kernel2, uint kernel_height, uint kernel_width, uint kernel_height2, uint kernel_width2, PixelFFFF backgroundColor, uint iterationCount, vImageFlags flags);
Beispiel #11
0
 extern static nint vImageRichardsonLucyDeConvolve_Planar8(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, short *kernel, short *kernel2, uint kernel_height, uint kernel_width, uint kernel_height2, uint kernel_width2, int divisor, int divisor2, Pixel8 backgroundColor, uint iterationCount, vImageFlags flags);
Beispiel #12
0
 public static vImageError ConvolveWithBiasARGBFFFF(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float *kernel, uint kernel_height, uint kernel_width, float bias, PixelFFFF backgroundColor, vImageFlags flags)
 {
     return((vImageError)(long)vImageConvolveWithBias_ARGBFFFF(ref src, ref dest, tempBuffer, srcOffsetToROI_X, srcOffsetToROI_Y, kernel, kernel_height, kernel_width, bias, backgroundColor, flags));
 }
Beispiel #13
0
 extern static nint vImageConvolveWithBias_ARGBFFFF(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float *kernel, uint kernel_height, uint kernel_width, float bias, PixelFFFF backgroundColor, vImageFlags flags);
Beispiel #14
0
 extern static nint vImageConvolveWithBias_ARGB8888(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, short *kernel, uint kernel_height, uint kernel_width, int divisor, int bias, Pixel8888 backgroundColor, vImageFlags flags);
Beispiel #15
0
 public static vImageError ConvolveWithBiasPlanar8(ref vImageBuffer src, ref vImageBuffer dest, IntPtr tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, short *kernel, uint kernel_height, uint kernel_width, int divisor, int bias, Pixel8 backgroundColor, vImageFlags flags)
 {
     return((vImageError)(long)vImageConvolveWithBias_Planar8(ref src, ref dest, tempBuffer, srcOffsetToROI_X, srcOffsetToROI_Y, kernel, kernel_width, kernel_height, divisor, bias, backgroundColor, flags));
 }