Пример #1
0
        bool PatternMatch(ref Sensor_data[,] s_data, int row, int col)
        {
            int[]     dirX = new int[] { -1, 0, 1, -1, 1, -1, 0, 1 };
            int[]     dirY = new int[] { -1, -1, -1, 0, 0, 1, 1, 1 };
            compare[] com  = new compare[] { compare.more_equal, compare.more_equal, compare.more_equal, compare.more, compare.more_equal, compare.more, compare.more, compare.more };

            short mid = get_date(ref s_data, row, col).value;

            if (mid < peak)
            {
                return(false);
            }

            for (int d = 0; d < dirX.Length; ++d)
            {
                int tr = row + dirY[d];
                int tc = col + dirX[d];
                if (!Sensor_data.BoundaryCheck(tr, tc))
                {
                    continue;
                }
                switch (com[d])
                {
                case compare.more:
                    if (get_date(ref s_data, tr, tc).value > mid || get_date(ref s_data, tr, tc).is_peak)
                    {
                        return(false);
                    }
                    break;

                case compare.more_equal:
                    if (get_date(ref s_data, tr, tc).value >= mid || get_date(ref s_data, tr, tc).is_peak)
                    {
                        return(false);
                    }
                    break;

                default:
                    break;
                }
            }
            get_date(ref s_data, row, col).is_peak = true;
            return(true);
        }
Пример #2
0
        List <short> get_arround7x7(ref Sensor_data[,] s_data, int row, int col)
        {
            List <short> ans = new List <short>();

            for (int y = -3; y <= +3; ++y)
            {
                for (int x = -3; x <= +3; ++x)
                {
                    int tr = row + y;
                    int tc = col + x;
                    if (!Sensor_data.BoundaryCheck(tr, tc))
                    {
                        ans.Add(0);
                    }
                    else
                    {
                        short sig = get_date(ref s_data, tr, tc).value;
                        ans.Add(sig);
                    }
                }
            }
            return(ans);
        }