Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Annotate handwritten essays with AI-powered error detection and highlighting. Uses OCR and fuzzy matching to mark errors and exemplary sentences with marker-style overlays.

License

Notifications You must be signed in to change notification settings

qiwei-ma/handwritten-essay-annotator

Repository files navigation

Handwritten Essay Annotator

A computer vision and text matching-based tool for automatically identifying and annotating errors and highlights in handwritten text. Annotation

Example

Example Output

The image above shows an annotated handwritten essay with error markers (red underlines) and highlights (green backgrounds).

Features

  • 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

Tech Stack

  • Python
  • OpenCV
  • FastAPI
  • PIL (Python Imaging Library)
  • FuzzyWuzzy (Text Matching)

Installation

  1. Clone the repository
git clone [repository-url]
cd handwritten-essay-annotator
  1. Install dependencies
pip install -r requirements.txt
  1. 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/ocr

Usage

Main Annotation Service

The project provides two versions of the annotation service:

Option 1: Modular Version (Recommended)

# Runs on port 8006
python main1.py

Option 2: Standalone Version

# Runs on port 8005
python main.py

Testing the API

# Test the annotation service (connects to port 8006 by default)
python api_test.py

Image Preprocessing Service (Optional)

# Runs on port 8002 - for image rotation and alteration removal
python image_process.py

Input Format

You need to provide:

  • Handwritten text image for annotation
  • Reference text for text matching
    • Error text snippets
    • Error types
    • Correction explanations
    • Highlight content markers

Output

  • Annotated text image with:
    • Error markers (with numbering)
    • Correction explanations
    • Content highlights

Configuration

API Credentials

Before using this tool, you need to configure your Baidu OCR API credentials:

  1. Copy config.py.example to config.py
  2. Register for a Baidu Cloud account and create an OCR application at https://cloud.baidu.com/product/ocr
  3. Fill in your client_id and client_secret in config.py

Service Ports

The default ports used by different services:

  • main.py: Port 8005
  • main1.py: Port 8006 (default for api_test.py)
  • image_process.py: Port 8002

You can modify the ports in each file's if __name__ == '__main__': section if needed.

Examples

The examples/ folder contains sample images.

License

MIT

Contributing

Issues and Pull Requests are welcome to help improve this project.

About

Annotate handwritten essays with AI-powered error detection and highlighting. Uses OCR and fuzzy matching to mark errors and exemplary sentences with marker-style overlays.

Topics

Resources

License

Stars

Watchers

Forks

Languages