Vietnamese High School Graduation Examination Answer Extraction using openCV-python
- Clone repository
- Run
pip install -r requirements.txt
- Change the image path in
tools/pipeline.py
- Run
python tools/pipeline.py
- Highly recommend using conda/miniconda for avoiding evironments conflicts.
- Test specific features? use the code in
tools/
- Running using
uvicorn app:app --port 1234
- Test API via Swagger UI: localhost:1234/docs
- Download and install Docker
- Have a look at Dockerfile
- Build image
docker build -t VNASE .
- Run container
docker run -d --name vnase -p 80:80 VNASE
- Test API via Swagger UI: localhost/docs
Input: Answer sheet captured image
Output: List of answers, student ID and exam code
Sample input:
-
Phase 1: Image preprocessing
- Remove background (using GrabCut)
- Paper contour detect
-
Phase 2: Extraction
-
Answer extraction:
- Preprocess: crop - convert to grayscale - remove noise - erore and dilate
- Detect answer boxes
- Extract answer by create a grid on template (have a look at grid.py)
-
Student ID and exam Code:
- Preprocess: crop - convert to grayscale
- Threshold - erore and dilate
- Detect selected bubbles - calculate output based on bubbles position
-
- https://learnopencv.com/automatic-document-scanner-using-opencv/
- https://docs.opencv.org/3.4/da/d22/tutorial_py_canny.html
- https://docs.opencv.org/3.4/d4/d73/tutorial_py_contours_begin.html
- https://www.analyticsvidhya.com/blog/2022/08/image-contrast-enhancement-using-clahe/
- https://docs.opencv.org/3.4/db/df6/tutorial_erosion_dilatation.html
- https://www.mathworks.com/help/visionhdl/ug/contrast-adaptive-histogram-equalization.html
- https://docs.opencv.org/3.4/d8/d83/tutorial_py_grabcut.html
- https://docs.opencv.org/3.4/da/d6e/tutorial_py_geometric_transformations.html