ARTICLE AD BOX
In my application, QR codes are placed at fixed physical locations, and some users are trying to bypass the intended usage by copying the QR code image and scanning it from a different position or direction than where it is actually installed. While I already validate the scan using GPS location, that alone is not sufficient because users can still be within the allowed radius but scan the copied QR code from an incorrect physical direction. To prevent this, I want to validate the direction from which the QR code is scanned. For example, if the QR code is meant to be scanned while facing north, then the user should always scan it from the north direction in every valid scan.
To achieve this, I treat the first valid scan as a reference and store the direction and alignment information of that scan. All subsequent scans are then compared against this reference to ensure the user is scanning the QR code from the same physical direction. The difficulty I am facing is in normalizing this first reference scan, because the user may initially scan the QR code while holding the phone in landscape mode, or from a sideways or tilted orientation. If this incorrect orientation is captured as the reference, it becomes the baseline for all future scans, allowing invalid scans to pass. I am looking for a reliable way to normalize or validate the initial reference scan so that orientation differences (portrait vs landscape or sideways first scans) do not compromise the direction-based validation logic.
