When applying for jobs, visas, or university portals, users are required to upload photos of their ID cards and documents. Frequently, these documents are rejected 48 hours later because the photo was too blurry or had too much camera flash glare, delaying the entire application process.
This project is a lightweight, pre-screening tool built with Python and OpenCV. Before a user uploads a document, this script analyzes the image using classical Computer Vision techniques to determine if it is legible.
- Blur Detection: Uses the Variance of the Laplacian method to measure edge sharpness. Images with a score below 100 are rejected.
- Glare Detection: Converts the image to grayscale and uses Binary Thresholding to calculate the percentage of blown-out white pixels caused by camera flash.
1. Install Dependencies
You will need Python installed on your system. Install the required Computer Vision libraries by running this command in your terminal:
pip install opencv-python numpy
2. Add Your Images
Place the images you want to test into the test_images folder.
3. Run the Script
Execute the main Python file from your terminal:
python main.py
--- Analyzing: test_images/good_doc.png ---
Blur Score: 13425.51 (Needs to be > 100)
Glare Amount: 77.26% (Needs to be < 85.0%)
✅ ACCEPTED: The document is clear and ready for upload!
--- Analyzing: test_images/blurry_doc.png ---
Blur Score: 60.35 (Needs to be > 100)
Glare Amount: 78.07% (Needs to be < 85.0%)
❌ REJECTED: The image is too blurry. Please hold the camera steady.