This is a submission for DEV's Summer Bug Smash: Clear the Lineup powered by Sentry.
Project Overview
OpenScanVision is an offline Android computer vision scanning system designed for fast and accurate scanning of structured voting cards.
The application uses the device camera to capture a card, detect its position, correct perspective distortion, decode QR information, and analyze OMR (Optical Mark Recognition) bubbles to produce accurate scan results.
The system uses computer vision techniques including ArUco marker detection, homography transformation, QR decoding, and optimized OMR bubble analysis to achieve reliable real-time scanning on mobile devices.
Bug Fix or Performance Improvement
The original OpenScanVision scanning pipeline used QR-based positioning combined with edge detection and homography transformation to detect, rotate, and wrap the card.
Although the approach worked, it had major performance and accuracy issues:
- Scan processing took 7000ms+ on Samsung A11
- Edge detection was slow and required heavy image processing
- Card boundary detection was unreliable with different angles and positions
- Incorrect perspective correction reduced QR decoding and OMR bubble detection accuracy
The main challenge was improving both speed and accuracy at the same time.
The goal was to replace the bottleneck in the detection pipeline and create a fast, reliable real-time scanner.
Code
Repository:
https://github.com/MatiwosKebede/openscanvisionnd
Main optimization commits:
-
0f0ba7bβ Implemented ArUco finder -
555d0c0β Improved ArUco position detection -
709b008β Added capture preview with overlay and perspective transformation -
961f8f5β Implemented high accuracy ArUco and OMR bubble detection -
1d5834bβ Improved QR decoding and accuracy
My Improvements
I replaced the original QR + edge detection based card localization pipeline with a four-corner ArUco marker-based computer vision pipeline.
Original Pipeline
Camera Frame
β
QR Detection
β
Edge Detection
β
Card Boundary Detection
β
Homography Transformation
β
Card Wrapping
β
QR + OMR Processing
The original approach had two major problems:
1. Edge detection created a large performance bottleneck.
2. Card boundary estimation was not reliable enough for accurate perspective correction.
This caused slow scanning and inconsistent recognition.
## Optimized Pipeline
Camera Frame
β
Four-Corner ArUco Detection
β
Accurate Card Corner Localization
β
Homography Transformation
β
Card Wrapping
β
QR Decoding
β
OMR Bubble Detection
Technical Improvements
- Replaced slow edge-based card localization with ArUco marker detection
- Added four ArUco markers on the card corners for stable position tracking
- Improved rotation and perspective correction
- Improved card wrapping accuracy using reliable corner coordinates
- Reduced unnecessary image processing operations
- Improved QR decoding reliability after accurate alignment
- Improved OMR bubble detection accuracy after consistent transformation
The main engineering challenge was balancing speed and accuracy.
During development, some optimizations increased speed but reduced accuracy. The final pipeline achieved both high performance and reliable recognition.
Results
The optimization transformed the scanner from:
7000ms+ β <140ms
on a Samsung A11 device.
The final system achieved:
- Faster real-time scanning
- Accurate card localization
- Reliable rotation correction
- Accurate perspective transformation
- High QR decoding accuracy
- High OMR bubble detection accuracy
- Better handling of different card positions and angles
This improvement transformed OpenScanVision from a slow and unreliable scanning pipeline into a fast and robust mobile computer vision system.
Best Use of Sentry
Not submitting for this category.
Best Use of Google AI
Not submitting for this category.
Top comments (0)