예제 #1
0
        public static Complex[,] FFT2D(Mat <byte> src)
        {
            Complex[,] data = new Complex[src.Rows, src.Cols];

            for (int i = 0; i < src.Rows; i++)
            {
                for (int j = 0; j < src.Cols; j++)
                {
                    data[i, j] = new Complex(src[i, j], 0);
                }
            }

            return(Fourier.FFT2D(data, FourierDirection.Forward));
        }
예제 #2
0
        public static Mat <double> IFFT2D(Complex[,] data, int rows, int cols)
        {
            data = Fourier.FFT2D(data, FourierDirection.Backward);

            Mat <double> result = new Mat <double>(rows, cols);

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    result[i, j] = data[i, j].real;
                }
            }

            return(result);
        }