Skip to content

vin-ni/postit-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Scanned Post-it Extractor

Extract individual post-it notes from scanned images. Detects colored post-its on a white background, straightens them, auto-orients the text, and saves each as a separate file.

Demo: multiple post-its on a scan

Extracted:

How it works

  1. Detection — Thresholds the HSV saturation channel to separate colored post-its from the white scanner background
  2. Straightening — Uses minAreaRect to find the precise bounding rectangle, then applies a perspective transform to de-skew
  3. Auto-orientation — Runs Tesseract OCR at 0/90/180/270 rotations and picks the orientation with the most recognized text

Requirements

  • Python 3
  • OpenCV (pip install opencv-python)
  • NumPy (pip install numpy)
  • Tesseract OCR (for auto-orientation)

On macOS:

brew install tesseract
pip install opencv-python numpy

Usage

python3 extract_postits.py image.jpg [image2.jpg ...]

Each detected post-it is saved as <basename>_postit_<n>.jpg alongside the input file.

Debug mode

python3 extract_postits.py --debug image.jpg

Generates additional debug images:

  • *_debug_mask.jpg — the saturation-based detection mask
  • *_debug_outline.jpg — detected bounding rectangles overlaid on the original

macOS Quick Action (right-click menu)

You can set up a Finder Quick Action so you can right-click any image and extract post-its directly.

  1. Open Automator and create a new Quick Action
  2. Set "Workflow receives current" to image files in Finder.app
  3. Add a Run Shell Script action
  4. Set Shell to /bin/zsh and Pass input to as arguments
  5. Paste the following script (update the paths to match your setup):
export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"

PYTHON="/path/to/python3"
SCRIPT="/path/to/extract_postits.py"

for f in "$@"; do
    "$PYTHON" "$SCRIPT" "$f"
done

osascript -e 'display notification "Post-its extracted!" with title "Post-it Extractor"'
  1. Save as Extract Post-its

The action will appear when you right-click image files in Finder under Quick Actions. Extracted post-its are saved next to the original file.

Tips

  • Works best with colored post-its (yellow, pink, green, blue) on a white/light background
  • Post-its can be at any angle
  • Multiple post-its per scan are supported
  • Auto-orientation works best when the post-it has legible handwriting or printed text

License

MIT

About

Extract individual post-it notes from scanned images. Detects, straightens, and auto-orients.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages