Building document scanner with opencv and python

Evergreen Technologies
3 min readJan 3, 2020

Author: Ravindra Sadaphule

Using some interesting combinations of techniques such as edge detection , finding contour and perspective transform, we can build a decent scanner application for document. It is useful for scanning pictures of receipts or pages in book as shown below. Later I’ll also show you example of how we can make this scalable by performing bulk scanning.

Here are basic steps in creating a scanner application in python

Step 1 -> Edge Detection : Edge detection is finding points where there are drastic changes in intensity. These points gives us edges of objects on the screen.

Code:

Step 2 -> Finding Contour : We then use edged picture from above to draw the contour around receipt image with green border as shown below. This contour is crucial to understand orientation and 4 important points (top left (tl), top right(top right), bottom right (br), and bottom left (bl)

--

--

Evergreen Technologies
Evergreen Technologies

Written by Evergreen Technologies

Decades of experience in collaborative Blog writing, Technical Advisory and Online Training. Read more about me @ https://evergreenllc2020.github.io/about.html

No responses yet