Skip to content

Automatically extract documents from images and perspectively correct them with classic computer-vision algorithms

Notifications You must be signed in to change notification settings

ad-si/Perspectra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Perspectra

Extract and perspectively correct documents in images.

Check out github:adius/awesome-scanning for and extensive list of alternative solutions.

Best Practices for Taking the Photos

TODO

Generating the Photos from a Video

A good tool for this purpose is PySceneDetect. It's a Python/OpenCV-based scene detection program, using threshold/content analysis on a given video.

For easy installation you can use the docker image

Find good values for threshold:

docker run \
  --rm \
  --volume (pwd):/video \
  handflucht/pyscenedetect
  --input /video/page-turning.mp4 \
  --downscale-factor 2 \
  --detector content \
  --statsfile page-turning-stats.csv

To launch the image run:

docker run \
  --interactive \
  --tty \
  --volume=(pwd):/video \
  --entrypoint=bash \
  handflucht/pyscenedetect

Then run in the shell:

cd /video
scenedetect \
  --input page-turning.mp4 \
  --downscale-factor 2 \
  --detector content \
  --min-scene-length 50 \
  --threshold 3 \
  --save-images

TODO: The correct way to do this: (after Breakthrough/PySceneDetect#45 is implemented)

docker run \
  --rm \
  --volume (pwd):/video \
  handflucht/pyscenedetect \
  --input /video/page-turning.mp4 \
  --downscale-factor 2 \
  --detector content \
  --threshold 5 \
  --save-images <TODO: path>

Aim for a low threshold and a long minimun scene length. I.e. turn the page really fast and show it for a long time.