Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6677713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:09:20+00:00 2026-05-26T04:09:20+00:00

I have a tiff file and the text on it, which has been OCR’d

  • 0

I have a tiff file and the text on it, which has been OCR’d at an earlier stage. The words have their exact positions as information (upper left, lower right). I now need to read the text within a user-drawn rectangle.

Normal paragraphs are no problem, but I don’t know how I should handle text columns. If there are two paragraphs next to each other, simply taking the row as a single line would make the result unusable.

Are there algorithms to help me put the words in the right order? I’m guessing that I have to examine the spaces between words to detect patterns that identify columns. I would like to avoid processing the image directly, although it should be possible (but no OCR).

I am also unsure about the influence of lists/tables, e.g. in orders & bills. A line-orientated approach would probably be better here.

I am developing in Delphi, but adaptable algorithms in other languages would also be appreciated.

edit: I will try to post sample data tomorrow, but basically I have an Array of Words, with their respective coordinates on the image (I could easily draw a rectangle around them, for example).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:09:20+00:00Added an answer on May 26, 2026 at 4:09 am

    Suppose your original text is in two columns like this:

    Aaaa bb ccc ddddd     mmmm nn oooo pp
    eee fff ggggg hh      qqq rrrrrrrrr
    i jjjj kkk lll        sss tttt uu.
    

    From your description, it sounds like your OCR has given you the individual words and their bounding rectangles. If the original page is scanned orthogonally, then all of the words on a given line should have the same (or very close) y values. If they’re not exactly the same, you can do an integer division on the vertical positions with some fraction of a typical box height. That should cluster the y values. You can do similar processing on the x coordinates to ensure that words at the edge of a column also have identical x values.

    To detect the separate columns, I’d try making a histogram of all the “left” values of all the words (or right edges if your text runs right-to-left). You should see a peak at the beginning of each column.

    You can probably rule out any false positives by ensuring that, on every line, there is a gap between the right coordinate of the last box before the candidate start of a column. The gap should probably be at least as large as the smallest width of any word.

    You can then partition your words up into column groups by checking which horizontal range their left and right coordinates fall in to. In our example, the words from Aaaa through lll would end up in the first partition and the words from mmmm through uu. would end up in the second partition.

    Within each partition, you can then partition on line by sorting on the y coordinates. Finally, for each line, you sort on the x coordinate. (Whether you sort on ascending or descending depends on your coordinate system and the direction your text flows.)

    The same basic idea could be applied to tables as well as columns of text, but you might need some tweaks to deal with things like right-justified cells.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a byte[] array, the contents of which represent a TIFF file (as
I have a TIFF file in memory, which I obtained by a variant of
I have a Tiff file that comes from a scanner. It has a resolution
I have to load .tiff file I did with both Image.FromFile() and Bitmap.FromFile() But
I have many file types: pdf, tiff, jpeg, bmp. etc. My question is how
I work with satellite radar, and have been provided with a (very) large TIFF
I have an xml file which I need to visualize in a pdf file.
In my properties file I have one property, which contains a comma separated list
Background I have a large TIFF file that is compressed with JPEG (new, compression
We have an AIR application which connects to a WAMP server. We support tiff

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.