A computer vision and text matching-based tool for automatically identifying and annotating errors and highlights in handwritten text.
The image above shows an annotated handwritten essay with error markers (red underlines) and highlights (green backgrounds).
- OCR-based handwritten text recognition
- Fuzzy text matching algorithm for improved recognition accuracy
- Intelligent annotation system with error marking and content highlighting
- Dynamic text position adjustment to avoid annotation overlap
- API interface support for easy integration into other systems
- Python
- OpenCV
- FastAPI
- PIL (Python Imaging Library)
- FuzzyWuzzy (Text Matching)
- Clone the repository
git clone [repository-url]
cd handwritten-essay-annotator- Install dependencies
pip install -r requirements.txt- Set up configuration
cp config.py.example config.py
# Edit config.py and fill in your Baidu OCR API credentials
# Get your API credentials at: https://cloud.baidu.com/product/ocrThe project provides two versions of the annotation service:
Option 1: Modular Version (Recommended)
# Runs on port 8006
python main1.pyOption 2: Standalone Version
# Runs on port 8005
python main.py# Test the annotation service (connects to port 8006 by default)
python api_test.py# Runs on port 8002 - for image rotation and alteration removal
python image_process.pyYou need to provide:
- Handwritten text image for annotation
- Reference text for text matching
- Error text snippets
- Error types
- Correction explanations
- Highlight content markers
- Annotated text image with:
- Error markers (with numbering)
- Correction explanations
- Content highlights
Before using this tool, you need to configure your Baidu OCR API credentials:
- Copy
config.py.exampletoconfig.py - Register for a Baidu Cloud account and create an OCR application at https://cloud.baidu.com/product/ocr
- Fill in your
client_idandclient_secretinconfig.py
The default ports used by different services:
main.py: Port 8005main1.py: Port 8006 (default forapi_test.py)image_process.py: Port 8002
You can modify the ports in each file's if __name__ == '__main__': section if needed.
The examples/ folder contains sample images.
MIT
Issues and Pull Requests are welcome to help improve this project.