Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Erase / remove borders from a table (scanned pdf)
#5
OK, so I made the script. Still fairly experimental and not fully documented
  • Get ofn-remove-grid from here (warning: not the same location as the other script) and install as indicated at the bottom of the page.
  • The script is reached by Filters>Enhance>Remove table/grid around text
  • The script works as above:
    • Does a color selection (uses the foreground color)
    • Creates a path from the selection
    • Removes the areas below a given size from that path
    • Creates a selection from the result
    • Bucket-fills the selection with the background color.
  • The parameters:
    • Grow selection before: amount to grow the selection after the color selection. Can be used to compensate for small discontinuities in the grid. Don't push that too much as it can make large blocks of letters contiguous and bigger than your smaller grid rectangle.
    • Area threshold: the area under which the selection parts are removed. A good way to estimate: slightly smaller than  the smallest rectangle in your grid (the 1.01 in yours). How to find out:
      • Make a rectangle selection slightly inside this area
      • Open the histogram (Windows>Dockable dialogs>Histogram) and look a the Pixels value which is the number of pixels included in the selection (about 18000 in your image)
    • Grow selection After: amount to grow the selection before the bucket fill. Add a 1 or 2 pixels to cover pixels that may be missed d to path inaccuracies.

Before:
   

After:
   


Enjoy.

Now trying to get some sleep before the roof flies off Smile
Reply


Messages In This Thread
RE: Erase / remove borders from a table (scanned pdf) - by Ofnuts - 10-01-2020, 10:02 PM

Forum Jump: