The template alignment problem is one of the central problems which currently remains unsolved for a general OMR sheet. This issue tracks various issues that we have noticed over a period of time in various samples.
Shifts during scanning
Despite fixing page curvature, we may still face the template alignment problem. Sometimes a scanner may malfunction at minute levels, we have seen uneven stretching of the page when using a basic scanner. The boxes need to be close to the bubbles otherwise the output is not reliable for any OMR checking software.
Example:
Curvature during bulk scanning
Sometimes the scan itself seems to be curved. we can see that the instructions text is not in a straight horizontal line.
Example:
The scans need to be straightened before applying template detection.
PDF-printed vs Photocopied misalignment
We have also seen shifts upto 10 pixels between scans of pdf-printed vs photocopied sheets. Link to an explainer: Google Drive
Describe the solution you'd like
Rough notes (ref):
- **Get all control-destination points **
- From SIFT:
- Filter list: Slide a 10px(windowSize) window on the image and pick the point with max score
- Filter list: pick the points with reasonable shifts(maxDisplacement)
- This way we can scale to any set of feature detectors like ORB or custom detectors from the ScanZones. Just need a set of control-destination pairs.
- **Align the points **
- Approach 1:
- Loop over each field, find 4 nearest anchor points and
- apply the transform on the field box using findHomography
- Approach 2:
- Triangulate the whole image based on the anchor points and
- perform affine transform on each triangle(all pixels get transformed)
Describe alternatives you've considered
There are many other approaches that can be tried:
We can also try to apply template matching over the "margin box" of a field-label? Hard to code, can't be sure if it covers all cases. In marked bubbles case: Still score might get max in the aligned. There's also the case of current question overflowing in the next question.
The template alignment problem is one of the central problems which currently remains unsolved for a general OMR sheet. This issue tracks various issues that we have noticed over a period of time in various samples.
Shifts during scanning
Despite fixing page curvature, we may still face the template alignment problem. Sometimes a scanner may malfunction at minute levels, we have seen uneven stretching of the page when using a basic scanner. The boxes need to be close to the bubbles otherwise the output is not reliable for any OMR checking software. Example:
Curvature during bulk scanning
Sometimes the scan itself seems to be curved. we can see that the instructions text is not in a straight horizontal line. Example:
The scans need to be straightened before applying template detection.
PDF-printed vs Photocopied misalignment
We have also seen shifts upto 10 pixels between scans of pdf-printed vs photocopied sheets. Link to an explainer: Google Drive
Describe the solution you'd like Rough notes (ref):
Describe alternatives you've considered There are many other approaches that can be tried:
Additional context NA