Optical Character Recognition (OCR) App

Project Summary

The OCR app is a cross-platform C++ application for extracting Arabic text from PDFs using Tesseract and GPU-accelerated machine-learning models. I built it to support OCR workflows involving distorted scans, low-quality documents, and handwritten Arabic content, where standard OCR tools often require additional preprocessing or provide limited control over individual pages.

Given a project directory and one or more PDF files, the application converts each page into an independently processable image. Users can apply image-correction techniques, select individual pages or batches, and run OCR using either a lightweight Tesseract model or a more advanced Arabic OCR model through local GPU inference. The extracted text can then be saved to a file or copied directly to the clipboard.

The application can be used to digitise scanned Arabic documents, recover text from degraded PDF pages, and support archival or document-processing workflows. It is written entirely in C++17 and uses Qt 5 for its cross-platform interface and operating-system abstractions, providing a foundation for further integration of specialised Arabic OCR and image-enhancement models.

Development Highlights

  • Built a C++/Qt desktop OCR application for extracting Arabic text from PDFs and image files using Tesseract, Leptonica, Poppler, and OpenCV libraries.

  • Implemented a PDF-to-image pipeline that renders pages through Poppler Qt5, stores generated PNGs in project directories, and supports configurable DPI-based OCR preparation.

  • Developed image processing utilities manually for OCR pre-processing, including deskew angle estimation, perspective dewarping, local contrast enhancement, and text-line bounding box extraction.

  • Designed a persistent OCR job queueing system with queued/running/paused/completed/failed/canceled states, JSON-backed project files, resumable progress tracking, failure reporting, and per-image output generation.

  • Integrated multiple OCR backends, including native Tesseract OCR and an external Qari/Qwen-based OCR executable, with configurable model options, prompts, GPU layer settings, and output handling.

  • Built reusable Qt UI components and controllers for project management, OCR execution, job progress display, pause/resume/cancel controls, and structured interaction between the desktop interface and processing services.

  • Added cross-platform CMake support for Linux and Windows, including vcpkg integration and a custom Poppler Qt5 overlay to keep dependency versions compatible with the Qt5 application stack.

Technical Design and Constraint

Architecture Classification

Qt Widgets MVC + Service Layer + Worker-Based Background Processing.

It is not strict MVVM (common in Qt based applications) because there are no dedicated view models with declarative bindings. The Qt widgets interact with controllers and services directly through signals, slots, and method calls. The application state is centralized through AppState object and persisted project schemas, while services perform most workflow coordination.

Constraint

The main constraint in the function of the application so far is that cross-platform builds require different dependency discovery paths pkg-config on Linux and vcpkg/CMake package discovery on Windows. The Qari backend is also constrained by subprocess execution, model availability and runtime dependencies.

Why did I write the OCR app?

I have a habit of reading and much of the literature that I am interested in is difficult to find. The text is usually only preserved in Arabic and the prints are often not available, so I end up reading many of these Arabic books in digital form. The unpopularity of the works means that the scanned or digital copies are usually very basic page-by-page scans of the original book where tilted pages, low-quality ink smudges and distortion is often found on every 2-3 pages turned.

On top of this, the text is often not selectable as the PDF usually just represents the entire page as an image. This means that to create a better print by copying and formatting the text into my own e-reader friendly document or translating it is a very arduous and manual process.

In an effort to automate this process, I set out to develop this OCR app, offering the conventional Tesseract model for simpelr tasks and allowing me to continuously add state-of-the-art Arabic text recognition ML models to the application at my behest. Writing this out in C++ allows me to optimize at a low-level and empower users to make the most out of their local hardware to translate, edit and re-format classical works of Arabic literature.

Demonstration

Below are several screenshots highlighting the application's interface and key features:`

Batch Selection in the UI Asynchronous Job Queuing Panel Qari Model Params Tesseract Model Params

Current Progress

Current

The OCR app is currently beyond MVP, with active development ongoing. It can process pages for OCR workflows and supports the core functionality needed to extract text from document images using demanding OCR/model-based processing.

Next Feature

Segmenting pages into tiles that can be OCR'd separately then stitched together to enable demanding model use on GPUs with limited VRAM.