// the find
xavctn/img2table
img2table is a table identification and extraction Python Library for PDF and images, based on OpenCV image processing
img2table extracts tables from images and PDFs using classical computer vision (OpenCV line detection) rather than neural networks. It handles bordered, semi-bordered, and borderless tables, wraps a handful of OCR engines behind a common interface, and hands you back a Pandas DataFrame or Excel file. The target audience is data engineers who need to pull structured data out of scanned documents without standing up a GPU or paying for a hosted model.
The CPU-only approach is genuinely useful — you can run this on a cheap VM or in a Lambda without worrying about CUDA drivers or inference costs. The OCR abstraction is clean: swap Tesseract for Textract or Google Vision with a one-line change and the rest of the code stays identical. Native PDF text extraction avoids running OCR at all when the PDF has embedded text, which is both faster and more accurate. The Cython hot paths (.pyx files for line identification and metrics) show someone actually profiled this rather than leaving it as pure Python.
Borderless table detection is opt-in and described as 'on top of' bordered detection, meaning you're running two separate passes and the false-positive rate on unstructured documents will hurt you. The library is explicitly scoped to light-background documents — dark or inverted layouts are not supported, which rules out a non-trivial slice of real-world scans. 878 stars and 120 forks after what looks like several years suggests limited adoption; the test suite leans heavily on pre-recorded fixtures and CSV comparisons rather than perceptual image tests, so regressions in tricky layouts could slip through. There's no streaming or incremental processing for large PDFs — everything is held in memory.