Beispiel #1
0
        public static int kernelGetSum(this L_Kernel kel, out float psum)
        {
            if (null == kel)
            {
                throw new ArgumentNullException("kel cannot be null.");
            }

            return(Native.DllImports.kernelGetSum((HandleRef)kel, out psum));
        }
Beispiel #2
0
        public static int kernelGetParameters(this L_Kernel kel, out int psy, out int psx, out int pcy, out int pcx)
        {
            if (null == kel)
            {
                throw new ArgumentNullException("kel cannot be null.");
            }

            return(Native.DllImports.kernelGetParameters((HandleRef)kel, out psy, out psx, out pcy, out pcx));
        }
Beispiel #3
0
        public static int kernelSetOrigin(this L_Kernel kel, int cy, int cx)
        {
            if (null == kel)
            {
                throw new ArgumentNullException("kel cannot be null.");
            }

            return(Native.DllImports.kernelSetOrigin((HandleRef)kel, cy, cx));
        }
Beispiel #4
0
        public static int kernelWriteStream(IntPtr fp, L_Kernel kel)
        {
            if (null == kel)
            {
                throw new ArgumentNullException("kel cannot be null.");
            }

            return(Native.DllImports.kernelWriteStream(fp, (HandleRef)kel));
        }
Beispiel #5
0
        public static int kernelSetElement(this L_Kernel kel, int row, int col, float val)
        {
            if (null == kel)
            {
                throw new ArgumentNullException("kel cannot be null.");
            }

            return(Native.DllImports.kernelSetElement((HandleRef)kel, row, col, val));
        }
Beispiel #6
0
        public static int kernelWrite(string fname, L_Kernel kel)
        {
            if (null == kel)
            {
                throw new ArgumentNullException("kel cannot be null.");
            }

            return(Native.DllImports.kernelWrite(fname, (HandleRef)kel));
        }
Beispiel #7
0
        public static int makeGaussianKernelSep(int halfheight, int halfwidth, float stdev, float max, out L_Kernel pkelx, out L_Kernel pkely)
        {
            IntPtr pkelxPtr, pkelyPtr;
            var    result = Native.DllImports.makeGaussianKernelSep(halfheight, halfwidth, stdev, max, out pkelxPtr, out pkelyPtr);

            pkelx = new L_Kernel(pkelxPtr);
            pkely = new L_Kernel(pkelyPtr);

            return(result);
        }
Beispiel #8
0
        public static void kernelDestroy(this L_Kernel pkel)
        {
            if (null == pkel)
            {
                throw new ArgumentNullException("pkel cannot be null");
            }

            var pointer = (IntPtr)pkel;

            Native.DllImports.kernelDestroy(ref pointer);
        }
Beispiel #9
0
        public static L_Kernel kernelCopy(this L_Kernel kels)
        {
            if (null == kels)
            {
                throw new ArgumentNullException("kels cannot be null.");
            }

            var pointer = Native.DllImports.kernelCopy((HandleRef)kels);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new L_Kernel(pointer));
            }
        }
Beispiel #10
0
        // Display a kernel in a pix
        public static Pix kernelDisplayInPix(this L_Kernel kel, int size, int gthick)
        {
            if (null == kel)
            {
                throw new ArgumentNullException("kel cannot be null.");
            }

            var pointer = Native.DllImports.kernelDisplayInPix((HandleRef)kel, size, gthick);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new Pix(pointer));
            }
        }
Beispiel #11
0
        public static Pix pixMultMatrixColor(this Pix pixs, L_Kernel kel)
        {
            if (null == pixs ||
                null == kel)
            {
                throw new ArgumentNullException("pixs, kel cannot be null.");
            }

            var pointer = Native.DllImports.pixMultMatrixColor((HandleRef)pixs, (HandleRef)kel);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new Pix(pointer));
            }
        }
Beispiel #12
0
        // Generic convolution(with float arrays)
        public static FPix fpixConvolve(this FPix fpixs, L_Kernel kel, int normflag)
        {
            if (null == fpixs ||
                null == kel)
            {
                throw new ArgumentNullException("pixs, kel cannot be null.");
            }

            var pointer = Native.DllImports.fpixConvolve((HandleRef)fpixs, (HandleRef)kel, normflag);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new FPix(pointer));
            }
        }
Beispiel #13
0
        // Convolution with bias(for non-negative output)
        public static Pix pixConvolveWithBias(this Pix pixs, L_Kernel kel1, L_Kernel kel2, int force8, out int pbias)
        {
            if (null == pixs ||
                null == kel1 ||
                null == kel2)
            {
                throw new ArgumentNullException("pixs, kel cannot be null.");
            }

            var pointer = Native.DllImports.pixConvolveWithBias((HandleRef)pixs, (HandleRef)kel1, (HandleRef)kel2, force8, out pbias);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new Pix(pointer));
            }
        }
Beispiel #14
0
        public static Pix pixConvolveSep(this Pix pixs, L_Kernel kelx, L_Kernel kely, int outdepth, int normflag)
        {
            if (null == pixs ||
                null == kelx ||
                null == kely)
            {
                throw new ArgumentNullException("pixs, kel cannot be null.");
            }

            var pointer = Native.DllImports.pixConvolveSep((HandleRef)pixs, (HandleRef)kelx, (HandleRef)kely, outdepth, normflag);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new Pix(pointer));
            }
        }
Beispiel #15
0
        public static Pix pixBilateralGrayExact(this Pix pixs, L_Kernel spatial_kel, L_Kernel range_kel)
        {
            if (null == pixs ||
                null == spatial_kel ||
                null == range_kel)
            {
                throw new ArgumentNullException("pixs, spatial_kel, range_kel cannot be null.");
            }

            var pointer = Native.DllImports.pixBilateralGrayExact((HandleRef)pixs, (HandleRef)spatial_kel, (HandleRef)range_kel);

            if (IntPtr.Zero == pointer)
            {
                return(null);
            }
            else
            {
                return(new Pix(pointer));
            }
        }