Airfrog editorial team ·

QR Codes at an Angle, in Motion Blur, and in Poor Lighting

How to test an SDK against perspective distortion, curved surfaces, blur, glare, low contrast, and small QR codes. What to adjust in image capture and how to compare decoders.

Rotation, perspective, and curved surfaces

Rotating a flat QR code in the image, perspective distortion, and bending around a bottle are different challenges. Perspective changes module size across the image, while a curved surface can violate the assumption of a flat grid. Passing a test with a rotated square does not show that a code on a pipe or package can be read.

Capture the same content from several angles and record the code’s position. Test the full image: reading a QR code that has already been cropped and straightened does not prove it can be detected in the original photo. Airfrog’s test scenarios include geometric distortion, but suitability for a particular curve must be checked separately.

Motion blur and defocus

Motion blur stretches edges along the direction of movement; defocus softens them in a different way. A shorter exposure, enough light, and proper focus can preserve information before the SDK runs. Sharpening an image after small modules have been lost is not the same as starting with a sharp image.

For a library that reads blurred QR codes, define the blur range and acceptable retake rate. Compare the time taken by successful and failed attempts: difficult frames can cause long delays even when the average looks good.

Lighting, glare, and low contrast

Shadows, digital noise, and overexposure test different limits. A fully blown-out glare spot may erase the modules entirely. For reflective labels, first change the lighting or camera angle, then evaluate algorithmic image processing.

Do not tune a single binarization threshold to one failed image. Check it on both light and dark images, keep the original, and compare each variant. Otherwise, a local improvement may hide regressions under normal conditions.

Small QR codes and high module density

The pixel size of each module matters, not just the overall image size. A large image with a small label can be harder to read than a smaller, sharp crop. Do not downscale images before measuring the smallest QR code your camera can read.

Test long distances, dense QR codes, and digital zoom separately. Do not promise a universal reading distance in meters based on one measurement: it depends on the lens, resolution, print size, and capture conditions.

Inverted and color QR codes

A light code on a dark background requires testing inverted polarity. A frame may contain both standard and inverted QR codes; reading one successfully does not prove the whole frame is complete. For color printing, check contrast after converting the image to grayscale, not just how different the colors look.

Busy backgrounds and combined distortions

Textures, nearby text, and borders can create false candidates. Include images without QR codes and combine difficult conditions, such as a small angled code with noise or motion blur on a dark label. Testing simple distortions only in isolation can overstate how well a decoder will handle a real image stream.

The benchmark methodology explains how to measure misses, false results, and latency. If the print itself is damaged, see reading damaged QR codes. For Python, see reading all codes from the original image bytes.

How to set up image capture before choosing a QR SDK

Start by capturing a few sharp images under good conditions. Then reintroduce real-world constraints one at a time: working distance, angle, movement, and lighting. This makes it easier to identify what causes misses without confusing poor lighting with a decoder error.

From symptom to capture adjustment
SymptomWhat to check first
Reads while still, misses while movingExposure time, motion blur, and whether there is enough light for a short exposure.
Reads better at the center than at the edgeFocus, geometry, and the apparent module size in those areas.
Reads on matte paper but not on filmReflections and the position of the light relative to the camera.
Reads close up but not in the full imageThe QR code’s pixel size and whether the image is downscaled before decoding.

Keep camera settings and original files with your test log. If you change the focus today and the library tomorrow, one overall percentage will not tell you what caused an improvement. For final validation, collect a separate set during normal operation, where distortions occur together.

Check the image boundaries too. A QR code can be sharp and high-contrast yet partly outside the frame. As a package moves, this can look like intermittent misses. Compare the coordinates of unread labels with the area the camera actually sees.

Questions about difficult QR images

How far away can Airfrog read a QR code?

There is no universal distance. It depends on the code’s physical size, lens, resolution, and lighting. Measure the smallest QR code your images can support, then test your working distance with some margin for movement and angle.

Can I correct perspective before decoding?

If you know where a flat QR code is, your application can straighten that region. But the original task still needs to find the code, and you must preserve the transformation to map coordinates back. A label curved around a cylinder requires separate testing: one flat transform cannot describe every surface.

How can I tell whether the new decoder made the difference?

Run both decoders on the same saved files with identical image preparation. After choosing one, compare the full production workflow separately. This helps distinguish decoding quality from changes in lighting, resolution, or cropping.