πŸ€– LateAI
Home β€Ί Tutorials β€Ί Optical Mark Recognition (OMR)
πŸ“

Optical Mark Recognition (OMR)

Intermediate Β· Half a day to 1 day
πŸ“Ά Intermediate ⏱ Half a day to 1 day πŸ’° Free (software only) 🏷 CV Zone

πŸ“Œ Overview

Photograph a paper answer sheet and it automatically reads the options the student filled in and scores the result: locate the sheet, correct the perspective, find the option cells, and decide the answer from how dark each cell is.

A classic education application whose whole pipeline rests on the fundamentals of OpenCV image processing - thresholding, contour detection, perspective transform, and pixel statistics. Comprehensive and well worth building.

🧰 What you need

πŸ”§ Step by step

1

Locate the answer sheet

Use edge detection plus contour detection to find the sheet quadrilateral

Warp the perspective so the sheet becomes a standard, straightened view

2

Grayscale and threshold

Convert to grayscale and then binary to separate filled areas from blank ones

Adaptive thresholding copes better with uneven lighting

3

Locate the option cells

Use row and column projections to find each question's option area

Or compute the cell positions from the fixed sheet layout

4

Decide what is filled

Measure the proportion of dark pixels inside each cell

Cells above the threshold count as filled

5

Build the answer and mark it

Concatenate the filled options into the student's answers

Compare against the answer key to compute the score

6

Output the result

Annotate each question right or wrong on the sheet and show the total

Batch-process many sheets and export a CSV

πŸ’‘ Tips

View original β†— ← Back to LateAI home