How hard can it be?
A thesis from 2005, a mantra that's followed me ever since...
It’s 2005. I’m in a computer lab in Sweden, a few months into my master’s thesis. The task: get a mobile phone to decode a barcode.
A 1D barcode. The black-and-white striped kind. One dimension.
Laser scanners had been reading barcodes at supermarket checkouts and library desks for decades. The camera in your pocket doing it in real time was the new part. Then Covid put the QR code on every café door and shop entrance, and the camera app learned to read both — bars and squares — without being asked. Today you point the phone and it resolves, in a heartbeat.
The phone is a Sony Ericsson W800i, walkman branding, the best mobile camera you could buy that year. You program it in Java 2 Micro Edition (J2ME).
There is no on-device GPU, no neural-net runtime, no library that will decode a stripe for you. We prototype in Matlab and port by hand.
The algorithm has a name: Morphism.
Find the barcode, mask it, detect its rotation, a 1D code encodes along one axis; the rest is repetition.
Next draw a scanline perpendicular to the bars, anti-aliased because a one-pixel line on a slant is never pixel-perfect.
We implement trig function tan ourselves; J2ME didn’t ship it.
We can’t drive the autofocus, so we bolt optical lenses onto the handset.
Then focus fails anyway, and bar width — where the data lives — stops meaning anything. So we stop measuring bars. We find midpoints, turn the stripe into a sine wave, measure centre to centre, denoise with a discrete cosine transform and rewrite the traditional barcode decoding algorithm to work with midpoints.

The algorithm is one piece. The system around it is the other, a runtime where every stage of the pipeline can run on the phone or on a Linux server, any stage on either side. Then bandwidth chooses for us. Over 3G, sending an image costs more than running the whole algorithm server-side and posting back the number.
The phone takes the picture; the server does the thinking. We have built a small distributed system to read a stripe.
Six months. One barcode. Two of us.
We were close to picking face recognition. I’m glad we didn’t.
The reason we took on the barcode at all was a phrase I’ve quietly run on for most of my life.
How hard can it be?
It is how we ended up in New Zealand.
How I found myself transport-sailing our new yacht through a late autumn Baltic gale off Landsort with one week of sailing experience.
How we decided to start from scratch and build an off-grid house on top of a hill 20,000 km away from home.
Stories for a different day.