Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table Image OCR 📊

A Python-based tool to automatically detect, extract, and convert tables from images into structured JSON and Excel formats using image processing techniques.


🚀 Features

  • Automatic Grid Detection: Automatically identifies rows and columns based on horizontal and vertical lines.
  • Visual Cropping: Crops image regions based on the detected table grid.
  • Dual Output: Exports extracted data into both structured JSON and standard Excel (XLSX) formats.

📦 Installation

Clone the repository and install the required dependencies:

git clone https://github.com/bimbim-byte/image-table-parser.git
cd image-table-parser
pip install -r requirements.txt

⚙️ Configuration

Before running the program, you need to configure the settings in config.py. Here are the key parameters you can adjust:

# Path to your input image and output directory
IMAGE_PATH = "data_test/test1.jpg"

# Sensitivity adjustments for grid detection
HORIZONTAL_PERCENT = 0.85
VERTICAL_PERCENT = 0.85
LINE_GAP = 2
MARGIN = 2

💡 Tip: If your table has blurry or dashed lines, try lowering the HORIZONTAL_PERCENT / VERTICAL_PERCENT and increasing the LINE_GAP.


💻 Usage

  1. Open config.py and set your IMAGE_PATH and OUTPUT_DIR.
  2. Adjust the detection sensitivity parameters if necessary.
  3. Run the main script:
python main.py

📂 Output Structure

Once the execution is complete, the OUTPUT_DIR will contain:

  1. Cropped Images: Visual segments of the table rows and columns.
  2. JSON File: Structured OCR data representing the table content.
  3. Excel File (.xlsx): Ready-to-use spreadsheet mapped from the image table.

📝 Important Notes

  1. Table-Only: This program is specifically designed for structured images that contain clear tables. It may not yield accurate results on standard unstructured text documents.
  2. Configuration Check: Ensure that config.py points to a valid image path before executing main.py.

About

An automated image-to-table parser that detects row and column grids, processes image regions, and converts tabular visual data into clean JSON and XLSX files.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages