Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 3
0
        private void EdgeDetect(object parameter)
        {
            int index = Convert.ToInt32(parameter);

            if (index == 0)
            {
                resultData = Tempxdrdata;
            }
            else if (index == 1)
            {
                resultData = Tempydrdata;
            }
            else if (index == 2)
            {
                resultData = Tempzdrdata;
            }
            else if (index == 3)
            {
                resultData = EdgeDetection.Thdr(Tempxdrdata, Tempydrdata);
            }
            else if (index == 4)
            {
                resultData = EdgeDetection.Asm(Tempxdrdata, Tempydrdata, Tempzdrdata);
            }
            else if (index == 5)
            {
                resultData = EdgeDetection.Tilt(Tempzdrdata, EdgeDetection.Thdr(Tempxdrdata, Tempydrdata));
            }
            else if (index == 6)
            {
                resultData = EdgeDetection.Theta(EdgeDetection.Thdr(Tempxdrdata, Tempydrdata), EdgeDetection.Asm(Tempxdrdata, Tempydrdata, Tempzdrdata));
            }
            else if (index == 7)
            {
                resultData = EdgeDetection.Nstd(Tempxdrdata, Tempydrdata, Tempzdrdata, winSize);
            }
            else if (index == 8)
            {
                resultData = EdgeDetection.Gdo(Tempxdrdata, Tempydrdata, Tempzdrdata, alpha, theta);
            }
            else if (index == 9)
            {
                resultData = EdgeDetection.Ita2(Tempxdrdata, Tempydrdata, Tempzdrdata);
            }
            else if (index == 10)
            {
                resultData = EdgeDetection.ETA1(Tempxdrdata, Tempydrdata, Tempzdrdata);
            }
            else if (index == 11)
            {
                resultData = EdgeDetection.HFTilt(Tempxdrdata, Tempydrdata, VxxData, VyyData, VxyData);
            }
            else if (index == 12)
            {
                resultData = EdgeDetection.HFTheta(Tempxdrdata, Tempydrdata, VxxData, VyyData, VxyData);
            }
            else if (index == 13)
            {
                var asmData = EdgeDetection.Asm(Tempxdrdata, Tempydrdata, Tempzdrdata);
                double[,] asmZdrData, asmXdrData, asmYdrData;
                if (isFrqDomain)
                {
                    var asmFrqData = FFT.fft_2D(new Complex2D(EdgeDetection.MinCurveExpand(asmData)));
                    asmZdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Zdrf(asmFrqData)).GetRe());
                    asmYdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Ydrf(asmFrqData)).GetRe());
                    asmXdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Xdrf(asmFrqData)).GetRe());
                }
                else
                {
                    asmZdrData = EdgeDetection.Zdr(asmData);
                    asmYdrData = EdgeDetection.Ydr(asmData);
                    asmXdrData = EdgeDetection.Xdr(asmData);
                }
                var asmThdrData = EdgeDetection.Thdr(asmXdrData, asmYdrData);
                resultData = EdgeDetection.Tilt(asmZdrData, asmThdrData);
            }
            else if (index == 14)
            {
                var tiltData = EdgeDetection.Tilt(Tempzdrdata, EdgeDetection.Thdr(Tempxdrdata, Tempydrdata));
                double[,] tiltXdrData, tiltYdrData;
                if (isFrqDomain)
                {
                    var tiltFrqData = FFT.fft_2D(new Complex2D(EdgeDetection.MinCurveExpand(tiltData)));
                    tiltYdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Ydrf(tiltFrqData)).GetRe());
                    tiltXdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Xdrf(tiltFrqData)).GetRe());
                }
                else
                {
                    tiltYdrData = EdgeDetection.Ydr(tiltData);
                    tiltXdrData = EdgeDetection.Xdr(tiltData);
                }

                resultData = EdgeDetection.Thdr(tiltXdrData, tiltYdrData);
            }
            else if (index == 15)
            {
                resultData = EdgeDetection.GuassNoise(anomalyData);
            }
            else if (index == 16)
            {
                resultData = EdgeDetection.Idct(EdgeDetection.Zdrf(EdgeDetection.Dct(anomalyData, false)));
            }

            var zmin = EdgeDetection.GetDataMin(resultData);
            var zmax = EdgeDetection.GetDataMax(resultData);

            ResultMin = zmin;
            ResultMax = zmax;
            ResultMap = GetMap(resultData, zmin, zmax);
        }