Exemplo n.º 1
0
        private SubMatrix GetOnlyTextArea(ImageMatrix matrix)
        {
            var tools         = new MatrixTools(matrix);
            var textRectangle = tools.FindTextSubmatrix();

            return(matrix.GetSubMatrix(textRectangle));
        }
Exemplo n.º 2
0
        public void CreateCopyImageMatrix(ImageMatrix matrix)
        {
            List <SubMatrix> matrixes = new List <SubMatrix>();
            Rectangle        rect     = new Rectangle
            {
                X      = 0,
                Y      = 0,
                Width  = matrix.Width - 1,
                Height = matrix.Height / 120
            };

            for (int i = 0; i < 100; ++i)
            {
                matrixes.Add(matrix.GetSubMatrix(rect));
                rect.Y += matrix.Height / 100;
            }
            long count = 0;

            foreach (var mat in matrixes)
            {
                for (int x = 0; x < mat.Width; ++x)
                {
                    for (int y = 0; y < mat.Height; ++y)
                    {
                        if (mat.Get(x, y))
                        {
                            count++;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public MatrixSplitter(FileStream stream)
        {
            var matrix  = new ImageMatrix(new Bitmap(Image.FromStream(stream)));
            var clearer = new BlurClearer(matrix);

            clearer.ClearShadows();
            textMatrix = matrix.GetSubMatrix(new MatrixTools(matrix).FindTextSubmatrix());
        }
Exemplo n.º 4
0
        private SubMatrix GetClearedTextMatrix(ImageMatrix matrix)
        {
            var clearer = new BlurClearer(matrix);

            clearer.ClearShadows();
            //overkill
            //clearer.ClearSingleLineBlurHorizontal();
            //clearer.ClearSingleLineBlurVertical();
            return(matrix.GetSubMatrix(new MatrixTools(matrix).FindTextSubmatrix()));
        }
Exemplo n.º 5
0
        private void PrepareImage()
        {
            workMatrix = new ImageMatrix(new Bitmap(Image.FromFile(simplePageUrl)));
            BlurClearer clearer = new BlurClearer(workMatrix);

            clearer.ClearShadows();
            MatrixTools tools = new MatrixTools(workMatrix);

            matrix = workMatrix.GetSubMatrix(tools.FindTextSubmatrix());
        }