Markus Blog

QR code orientation

· Markus

…where I estimate free space using a single camera.

QR Rotation

I recently revisited an old idea to see a coding agent (Claude Sonnet in this case) deal with the coordinate systems and implement it.If you can

1️⃣ estimate the orientation of a QR code as seen by the phone camera, and

2️⃣ estimate the phone’s orientation in world coordinates using gravity and compass,

➡️ you can derive the QR code’s orientation in world coordinates.

So with the QR code fixed in place, that orientation should stay roughly constant — no matter how the phone is held.

Creating the app went straightforward as expected. But I had not created an environment for Claude to test the orientation logic. Figuring out that small coordinate-systems puzzle consisting of world, device, camera, QR code, plus UI coordinates tied to device orientation, turned into a moment of joint effort. Instead of Claude making a best guess and see if it works, we were reasoning about coordinate systems, debugging strategies, and deciding what to analyze next and how. It was an interesting experience and I have a good understanding of the outcome.

👉 But of course enabling Claude to test and figure things out on its own is the way to go. 👈

I originally developed this idea in a research project on digitizing ICU nursing documentation, where QR codes on adjustable bed backrests were used to infer patient upper-body elevation from gravity. ±3° precision were more than enough.

Curious to hear: what other use cases come to mind?