Beispiel #1
0
        public static void Bilevel(int[,] img)
        {
            //二值化
            int T = FindT.Threshold(img);
            int pix;
            int height = img.GetLength(0);
            int width  = img.GetLength(1);

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (img[y, x] < T)
                    {
                        pix = 0;
                    }
                    else
                    {
                        pix = 255;
                    }
                    processpix[y, x] = pix;
                    //img.SetPixel(x, y, Color.FromArgb(img.GetPixel(x, y).A, pixel, pixel, pixel));
                }
            }
        }
        public static void SetEdge(int[,] img)
        {
            int sobelT = FindT.Threshold(img);
            int pix;
            int height = img.GetLength(0);
            int width  = img.GetLength(1);

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (isEdge(x, y, sobelT - 80))//讓邊緣更明顯
                    {
                        pix = 0;
                        processpix[y, x] = pix;
                    }
                }
            }
        }