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:Create a subdirectory
Your provider must be in its own subdirectory inside
/src/ocr/providers/. For example: /src/ocr/providers/my_cool_ocr/.Implementation steps
Step 1: Set up the directory structure
Create your provider directory:Step 2: Define your provider class
Inprovider.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
Yourscan method must perform three key tasks:
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
Transform the data
Convert your OCR engine’s proprietary format into meikipop’s standard data model using
BoundingBox, Word, and Paragraph objects.Complete example: Dummy provider
Here’s the complete dummy provider that demonstrates all required transformations:src/ocr/providers/dummy/provider.py
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
Common OCR integration patterns
Python library integration
REST API integration
Command-line tool integration
Activating your provider
Once your provider is implemented: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