gitwtfhub

wtf is flatbed-scanner-calibration?

midorino555/flatbed-scanner-calibration — explained in plain English

Analysis updated 2026-05-18

0PythonAudience · generalComplexity · 3/5Setup · moderate

TL;DR

A Python tool that measures a flatbed scanner's geometric distortion using a printed dot grid, then corrects future scans for accurate CAD tracing.

Mindmap

mindmap
  root((scanner calibration))
    What it does
      Measures scanner distortion
      Fits correction model
      Applies correction to scans
      Preserves original files
    Tech stack
      Python
      OpenCV
      PIL
    Use cases
      CAD tracing accuracy
      Flatbed scanner calibration
      Batch scan correction
    Platforms
      Windows batch script
      macOS Quick Action

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Correct geometric distortion in scanned paper drawings before tracing them in CAD software.

REASON 2

Generate a scanner-specific calibration file from a printed dot grid target.

REASON 3

Batch-correct scans by dragging files onto a script on Windows or a Quick Action on macOS.

What's in the stack?

PythonOpenCVPIL

How it stacks up

midorino555/flatbed-scanner-calibration0xallam/my-recipe0xhassaan/nn-from-scratch
Stars00
LanguagePythonPythonPython
Last pushed2022-11-22
MaintenanceDormant
Setup difficultymoderatemoderatemoderate
Complexity3/52/54/5
Audiencegeneralgeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 1h+

Requires a printer and flatbed scanner, careful physical measurement of a printed target, and per-scanner calibration.

No license information is provided in the README.

Wtf does this do

This project measures and corrects the geometric distortion of a consumer flatbed scanner, so that scanned paper drawings come out accurate enough to trace directly in CAD software. The author built it for scanning technical drawings into Fusion 360, but it works with any flatbed scanner, not just the specific model they used. Flatbed scanners are not perfectly accurate: straight lines can come out slightly bent, and the amount of distortion varies across the scan bed rather than being a simple, constant scaling error. That means the error cannot be fixed just by resizing or rotating the image afterward. This tool measures that distortion by scanning a printed grid of dots, fitting a mathematical correction model to how those dots are displaced from where they should be, and then applying that correction to future scans. In the author's testing, average error across an A3 page dropped from about 0.37 millimeters to about 0.04 millimeters after correction. Using it involves printing a calibration target at exactly 100 percent scale, carefully measuring the printed target itself with a ruler to account for any paper shrinkage from printing, scanning that target with all automatic corrections turned off, then running a Python script to build a calibration file specific to your scanner. Once that calibration file exists, a second script applies it to any new scan, saving both a corrected image and a backup of the original so nothing gets overwritten by accident. Windows users can drag a scan onto a batch file to apply the correction, and macOS users have an equivalent right-click Quick Action. Setup requires Python 3.9 or newer and a few Python packages installed via pip. The README stresses that a generated calibration file only works for the exact scanner it was made from and should not be shared or reused between different machines.

Yoink these prompts

Prompt 1
Walk me through printing the calibration target and scanning it correctly for this tool.
Prompt 2
How do I run calibrate.py to build a scanner_calibration.json file from my dot grid scan?
Prompt 3
Explain why I need to measure my printed target with a ruler before running the calibration.
Prompt 4
How do I use apply_correction.py or the Windows batch file to fix a scanned drawing?

Frequently asked questions

wtf is flatbed-scanner-calibration?

A Python tool that measures a flatbed scanner's geometric distortion using a printed dot grid, then corrects future scans for accurate CAD tracing.

What language is flatbed-scanner-calibration written in?

Mainly Python. The stack also includes Python, OpenCV, PIL.

What license does flatbed-scanner-calibration use?

No license information is provided in the README.

How hard is flatbed-scanner-calibration to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is flatbed-scanner-calibration for?

Mainly general.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.