The process was accomplished using OpenCV and can be broken down into just four simple steps:
- Detect edges.
- Use the edges to find the contour (outline) representing the paper to be scanned.
- Apply a perspective transform to obtain the top-down view of the document, a 90-degree view of the image.
- Apply thresholding to get a nice, clean black and white feel to the piece of paper.