top of page

How the Image Processing Works

Take in an image from the user. In this case, the image is very underexposed, so we will run our for loop that determines it is a generally dark image, run our for-loop for thresholds from the bottom up, and it will go through a series of different thresholds and a median filter after being changed to grayscale.

 

Thresholding turns an image into a binary image, setting all pixels to either black or white, depending on what side of the threshold they lie on. The median filter is very useful for removing noise from an image while preserving edges. It does this replacing outlying pixel values with the median value of neighboring pixels.

​

The threshold is applied at 18 values: incrementing .05 in value between thresholds, ranging from 1.0 to 0. The order of which threshold is applied first is dependent on how the image in general looks, whether it's over or underexposed. At each level, we run an optical character recognition (OCR) function from the pytesseract library. If the OCR is able to make out an 8 digit student ID, and two lines of text above it, we send the lines of of text, to the Middlebury directory If the OCR can't make out the ID or lines of text above it, it loops back to the next lowest threshold and tries again.

​

It wasn't easy to finally perfect a method that could consistently pull information from an ID. To see what else we tried visit our issues and future work page.

bottom of page