An OpenCV project for detecting books, papers, or any rectangular objects in an image, regardless the perspective, and straightening it as if it was a normal scan.
Images from example runs can be found in the results folder.
Automaticly (heuristically) setting the argument parameters (height and closing) to find the best fit.
We have set a noise removal level of 3.
$> python2.7 scan.py -i img/example9.jpg -a -n 3
$> python2.7 scan.py -i img/example10.jpg -H 400 -c 1 -n 2
- Detection steps
- Original image
- Bilateral filter
- Canny edges + Morphological closing
- Contour detection
- Fixing the perspective and applying adaptive thresholding
$> python2.7 scan.py -i img/example5.jpg -H 600 -c 3
- Detection steps
- Fixing the perspective and applying adaptive thresholding