Thanks to visit codestin.com
Credit goes to github.com

Skip to content
ssppkenny edited this page Oct 18, 2019 · 20 revisions

The Problem

The problem Flow Reader is supposed to resolve is fitting of printable page size of electronic book into device screen. Existing readers suggests two approaches for this case: First approach is to zoom print page to squeeze it into device screen:



Backside of this is font size which makes text hardly readable. Second approach is to show part of the page and allow user to scroll it to view other parts:



Suggested Solution

Suggested solution is to recognise text glyphs and reflow them into given device screen:



Algorithm Description

  1. Do some image pre-processing: binarise the image, invert
  2. Use recursive xy-cut algorithm to segment the image in blocks.
  3. For each block
  4. Find all connected components of pixels and their bounding boxes
  5. Remove bounding completely included in larger boxes Make a histogram of the component heights
  6. Filter out components which are bigger than some threshold
  7. Create an empty graph, which will represent a page
  8. Connect all the components horizontally so that left component is connected to a component immediately to the right, if nothing is to the right, no connection should be made.
  9. Find all connected components in that graph, they will represent the text lines.
  10. Each text line will contain connected pixel components.
  11. Find bounding rectangle for each pixel component.
  12. Make a histogram of the upper and lower coordinates of that rectangle.
  13. Maximums of the histogram will show us the upper and lower baselines.
  14. Split each line using the whitespace between symbols.
  15. Produce a list of symbol rectangles.
  16. Reflow can now be made using found symbol rectangles.

References:

Clone this wiki locally