Пример #1
0
        public static double[,] FilterProject(double[,] z, int expendMethod, double filterProject)
        {
            int row = z.GetLength(0);
            int col = z.GetLength(1);

            int expendRow = EdgeDetection.GetExpanNum(row);
            int expendCol = EdgeDetection.GetExpanNum(col);
            int row1      = (expendRow - row) / 2;
            int row2      = expendRow - row1 - row;
            int col1      = (expendCol - col) / 2;
            int col2      = expendCol - col1 - col;

            var expend   = Expend(z, expendMethod, row1, row2, col1, col2);
            var frqData  = FFT.fft_2D(new Complex2D(expend));
            var zdrfData = ExpandRestore(FFT.idft_2D(EdgeDetection.Zdrf(frqData)).GetRe(), row, col, row1, col1);

            var project = GetProject(zdrfData);

            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < col; j++)
                {
                    if (project[i, j] < filterProject)
                    {
                        project[i, j] = 1.70141e38;
                    }
                }
            }

            return(project);
        }
Пример #2
0
        public static double[,] Filter(double[,] z, int expendMethod, double filterProject, int length)
        {
            int row = z.GetLength(0);
            int col = z.GetLength(1);

            int expendRow = EdgeDetection.GetExpanNum(row);
            int expendCol = EdgeDetection.GetExpanNum(col);
            int row1      = (expendRow - row) / 2;
            int row2      = expendRow - row1 - row;
            int col1      = (expendCol - col) / 2;
            int col2      = expendCol - col1 - col;

            var expend   = Expend(z, expendMethod, row1, row2, col1, col2);
            var frqData  = FFT.fft_2D(new Complex2D(expend));
            var zdrfData = ExpandRestore(FFT.idft_2D(EdgeDetection.Zdrf(frqData)).GetRe(), row, col, row1, col1);

            return(Filter(z, zdrfData, filterProject, length));
        }