A Review of the Document Scanner
Explore how to build a document scanner by processing images with OpenCV. Learn techniques like grayscale conversion, edge detection, contour detection, ordering contour points, and warping images to isolate documents.
We'll cover the following...
We'll cover the following...
Let’s look at the correct code for creating the document scanner.
First, we set the size of our document after scanning.
frameWidth = 480
frameHeight = 640
Image Processing
We change the image to grayscale and then make it blurry. This helps us get the edges properly. To get the edges, we use the cv2.canny() function of the OpenCV library:
Get image contours
Next, we define the variable that we’ll use in this function. We define a NumPy array, biggest, and an integer, bArea. We use the cv2.findcontours method to find all the contours:
We loop ...