Example #1
0
        public Page(System.Drawing.Bitmap page, ReadingDirection direction, ICellsSegmentation extractor, ICellReadingOrder order)
        {
            this.Content = page;
            this.Direction = direction;

            var ExtractedCells = extractor.Extract(page);

            if (ExtractedCells.FullPage)
            {
                this.Cells = new List<IPolygon>(new Polygon[] { Polygon.Rectangle(0, 0, page.Width, page.Height) });
                this.TransformedCells = (from cell in this.Cells select (new TransformedPolygon(cell, ReadingDirectionToMatrix(this.Direction))));
            }
            else
            {
                var transformedCells = (from cell in ExtractedCells.Polygons
                                        select new TransformedPolygon(cell, ReadingDirectionToMatrix(direction)));

                this.TransformedCells = order.GetReadingOrder(transformedCells);
                this.Cells = (from cell in this.TransformedCells select ((TransformedPolygon)cell).BasePolygon);
            }
        }
Example #2
0
        private IEnumerable<TransformedPolygon> getSortedPoly(Bitmap input, ICellsSegmentation segmentation)
        {
            Matrix tsf = Page.ReadingDirectionToMatrix(getReadingDirection());
            var polygons = currentResult.Polygons;
            var tpolys = (from poly in polygons select new TransformedPolygon(poly, tsf));

            MangaParser.Reader.ICellReadingOrder ro = new MangaParser.Reader.DefaultReadingOrder();

            return (from tpoly in ro.GetReadingOrder(tpolys) select (TransformedPolygon)tpoly);
        }