Skip to main content

Overview

This guide explains how to create your own OCR provider to use with meikipop. This allows you to integrate any OCR engine you prefer, whether it’s an offline model, a web service, or a commercial API.
The best way to start is to copy the entire /src/ocr/providers/dummy/ directory, rename it, and modify its contents. The dummy provider is a fully commented template designed for this purpose.

Automatic discovery

Meikipop automatically discovers and loads any valid OCR provider. To be discovered, your provider must meet two conditions:
1

Create a subdirectory

Your provider must be in its own subdirectory inside /src/ocr/providers/. For example: /src/ocr/providers/my_cool_ocr/.
2

Create provider.py

Your subdirectory must have a provider.py file containing a class that inherits from OcrProvider.
Once these conditions are met, meikipop will automatically detect and load your provider on startup.

Implementation steps

Step 1: Set up the directory structure

Create your provider directory:

Step 2: Define your provider class

In provider.py, create a class that inherits from OcrProvider:
src/ocr/providers/my_cool_ocr/provider.py
The NAME property is required and must be a unique, user-friendly string. This name appears in the settings and tray menu.

Step 3: Implement the scan method

Your scan method must perform three key tasks:
1

Obtain OCR data

Call your OCR engine to get raw results. This could be:
  • A Python library call
  • A REST API request
  • A command-line tool execution
  • A local model inference
2

Transform the data

Convert your OCR engine’s proprietary format into meikipop’s standard data model using BoundingBox, Word, and Paragraph objects.
3

Return the results

Return a List[Paragraph] on success, an empty list [] if no text found, or None if a critical error occurred.

Complete example: Dummy provider

Here’s the complete dummy provider that demonstrates all required transformations:
src/ocr/providers/dummy/provider.py
You can provide the interface file, your provider template, and sample JSON output from your OCR engine to an AI assistant (like GPT-4 or Claude) and ask it to write the adapter code for you. This can get you 90% of the way there.

Data transformation patterns

Converting bounding boxes

Your OCR engine likely returns pixel coordinates. You must normalize them:

Determining text direction

If your OCR engine doesn’t provide text direction, infer it from the bounding box:

Handling word vs. character granularity

Meikipop works well with both word-level and character-level boxes. Character-level boxes often provide more precise lookups.

Common OCR integration patterns

Python library integration

REST API integration

Command-line tool integration

Activating your provider

Once your provider is implemented:
1

Run meikipop

Start the application. Your provider will be automatically discovered.
2

Open the tray menu

Right-click the meikipop tray icon.
3

Select OCR provider

Navigate to OCR Provider in the menu.
4

Choose your provider

Select your provider by its NAME from the list. Meikipop will now use your class for all OCR operations.
Make sure your provider’s NAME is unique to avoid conflicts with existing providers.

Testing and debugging

Enable debug logging

Validate coordinates

Next steps

OCR provider interface

Complete reference for the interface and data models

Available providers

Explore the built-in OCR providers for more examples