Skip to content

kristofer84/analog-timestamp-parser

Repository files navigation

7-Segment Photo Date Parser & EXIF Updater

This tool extracts 7-segment-style timestamps from images (e.g., old digital cameras, CCTV), allows manual correction via a visual tool, and updates EXIF DateTimeOriginal metadata accordingly.


🧩 Project Overview

The pipeline consists of three steps:

  1. Extract Date Strings (OCR)
    Run dates_to_json.py to detect and OCR date stamps into output.json.

  2. Manual Correction & HSV Tuning
    Launch the visual tool in hsv_filter_tool/ to inspect and correct extracted dates.

  3. Update EXIF Metadata
    Use update_files.py to write these dates into the image files' EXIF data.


📦 Installation & Setup

1. Python Environment

python3 -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows
pip install -r requirements.txt

2. Tesseract OCR

Install Tesseract:

  • Ubuntu: sudo apt install tesseract-ocr
  • macOS (Homebrew): brew install tesseract
  • Windows: UB Mannheim Tesseract

7-Segment OCR Model

wget https://github.com/Shreeshrii/tessdata_ssd/raw/refs/heads/master/ssd.traineddata -O 7seg.traineddata
sudo mv 7seg.traineddata /usr/share/tesseract-ocr/5/tessdata/

Then verify:

tesseract --list-langs  # should list '7seg'

3. Web Tool for Manual Review (HSV Filter Tool)

Install and serve with:

npm install -g http-server
cd hsv_filter_tool
http-server

Open your browser to http://localhost:8080


🚀 Usage

Step 1: Run OCR

python dates_to_json.py /path/to/image_folder --debug

Creates output.json.

Step 2: Manual Review

  • Visit http://localhost:8080
  • Upload:
    • Images
    • output.json
  • Correct dates manually.
  • Click Export JSON to download updated metadata.

Step 3: Update EXIF Dates

python update_files.py /path/to/updated_metadata.json

Optional: --dry-run to preview changes.


📁 Folder Structure

.
├── dates_to_json.py
├── hsv_filter_tool/
│   ├── config.json
│   ├── index.html
│   ├── script.js
│   └── style.css
├── requirements.txt
└── update_files.py

📖 License

MIT