Automatic multiple-choice exam grader built with Java and OpenCV.
Status: Archived. Built during an internship as a learning project and kept public as a portfolio piece. A cross-platform rewrite in Flutter may follow.
CorrectExams reads a scanned multiple-choice answer sheet, detects which bubbles are filled, grades the responses against an answer key, and exports the results to CSV — ready for a spreadsheet or grade book.
The image-processing pipeline uses OpenCV to locate the bubble grid and classify each bubble as filled or empty by pixel density.
- Language: Java 21
- GUI: Swing (NetBeans Form designer)
- Computer vision: OpenCV 4.9.0 via the openpnp/opencv wrapper (no native install required)
- CSV export: opencsv 5.9
- Build: Maven
- JDK 21 or newer
- Maven 3.8+
git clone https://github.com/cguzmancode/CorrectExams.git
cd CorrectExams
mvn clean package
mvn exec:java
mvn exec:java uses the exec.mainClass property declared in pom.xml, so no extra flags are needed.
How it works
1. The user loads a scanned answer sheet from the Swing UI.
2. OpenCV preprocesses the image and detects the answer region (Rectangle.java) and the bubble grid (Circle.java).
3. Each bubble is classified as marked or unmarked based on pixel density.
4. Detected answers are compared against the configured answer key.
5. Results are written to a CSV file with the final score and a per-question breakdown.
Entry point: com.cristian.detectexam.DetectExam.
Project structure
.
├── pom.xml
└── src/main/
├── java/com/cristian/detectexam/
│ ├── DetectExam.java # Entry point
│ ├── MainScreen.java # Swing UI
│ ├── MainScreen.form # NetBeans form definition
│ ├── Circle.java # Bubble detection
│ └── Rectangle.java # Answer-region detection
└── resources/ # UI assets (PNG icons)
Background
This was my first serious project using computer vision — built during an internship as a working tool rather than a polished product. The goal was to save teachers the time of grading paper exams by hand.
The code is kept public for transparency and as a snapshot of where I was when I wrote it.
License
No license is currently set, so all rights are reserved by default. Open an issue if you'd like to reuse the code and I'm happy to add a permissive license (e.g. MIT).
Tres detalles que conviene rematar en GitHub mismo, no en el README, para que el repo se vea cuidado:
1. **Description** (en el panel "About"): *"Multiple-choice exam grader built with Java 21, Swing and OpenCV. Exports results to CSV."*
2. **Topics**: `java`, `opencv`, `swing`, `computer-vision`, `education`, `exam-grader`, `maven`.
3. **Screenshot**: si encuentras una captura de la UI funcionando con un examen de muestra, súbela y reemplaza el bloque "What it does" con ``. Es lo que más cambia la primera impresión de un repo de UI.