Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Detect Words in Pages

A dynamic, interactive computer-vision tool to extract precise word-level and line-level bounding boxes from PDFs and images. Fine-tuned for Arabic script by default, but fully adjustable for any alphabet.

Example Results

Arabic (Default):

Example Arabic 1 Example Arabic 2

Latin Alphabet:

Example Latin Alphabet

Installation & Setup

  1. Clone the repository.
  2. Create and activate a conda environment:
    conda create -n qiraah python=3.10
    conda activate qiraah
  3. Install dependencies:
    pip install -r requirements.txt

Usage

Run with or without a file path:

python main.py
# Or with a specific file
python main.py path/to/document.pdf

Controls: d (Next), a (Previous), g (Go to page), ESC (Exit).

Adjustable Parameters

Adjustable Parameters

  • Use Otsu: Set to 1 to let the tool automatically find the best black & white balance. Set to 0 to adjust it manually.
  • Thresh Val: If Otsu is 0, adjust this to manually change the black & white balance. Increase to make text thicker/darker.
  • Kernel X: Controls horizontal grouping. Increase this to connect disconnected letters into single words.
  • Kernel Y: Controls vertical grouping. Keep this low to prevent different text lines from bleeding into each other.
  • Min Width / Height: Filters out small specks of dirt or noise. Boxes smaller than these values are ignored.
  • Max Height: If a box gets too tall, the tool assumes multiple lines merged by mistake and splits them.
  • Max Width: If a box gets too wide, the tool assumes words merged into a paragraph and splits them.
  • Merge Dist: The maximum pixel distance between two boxes to combine them into one word.
  • Refine On: Set to 1 to enable an extra cleanup pass that fixes overly large boxes.
  • Max Merge W / H: During cleanup, any box larger than these limits gets broken down again.
  • Close Merge D: During cleanup, uses a smaller, stricter distance to safely reconnect broken words.
  • Margin L/R/U/D: Adds a clean border (Left, Right, Up, Down) around your final bounding boxes.

About

Detect words on book pages using image processing (Fast & Accurate)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages