Why I made NutriLens

A few years ago I was creating an Android app that used a popular UK supermarket’s public API (no prizes for guessing which company) to retrieve nutritional information about food products. The whole idea of the app was to use the traffic light system to give shoppers a better idea of which products were truly healthy. One day I was testing the app and noticed that the product information was there but not the nutritional data. I posted to the API forums about this and somebody replied and said they were looking into it. Then the thread mysteriously disappeared. The nutritional data never came back. I have no idea why this happened but I can guess. I thought all of my efforts had been wasted and I would have to stop developing the app.

Then I had the idea of using OCR (Optical Character Recognition) and the device’s camera to read the text on the food packaging, parse it, validate it, perform some simple mathematics and display the traffic light nutritional info. NutriLens was born and it had the advantage of not being dependent on a third party API that might change or be decommissioned. It was still a difficult app to develop. If the device moves or tilts all the position information for the text changes and sometimes it assigns the incorrect amounts to the macro nutrients. This is especially true of the table on the back of good packaging as there is a lot of information. However, with some regular expressions and heuristics it does a pretty good job.

A lot of people think that this sort of thing is not needed because its obvious which are the healthy foods and which aren’t. It’s really not. Companies use branding and packaging to make products look healthier than they are. For example, low fat yogurt can contain a lot of sugar, cereals with sporty branding contain sugar and words like “Natural”, “Organic” and “Protein” are used to distract consumers from the real nutritional data. More insidious is the way companies use neutral coloured lozenges on the front of packaging. Take this photo of the packaging from a healthy looking granola bar:

It looks pretty healthy. Elsewhere on the packaging there are some of those words I mentioned above. Somebody might choose this product instead something stereo typically unhealthy like a chocolate bar. But look at what NutriLens makes of the those numbers:

It’s red on fat and saturated fat and orange on sugar and salt! None of the nutrients have a green traffic light. This is why NutriLens exists. It’s still up to the consumer to decide to buy the product or not but they can do so with a little more knowledge than before. Something with these traffic lights should only be eaten occasionally as a treat. I realise its a niche app and it’s not going to take over the world but at least it can provide some clarity and hopefully highlight the tricks the food industry use to sell their products. NutriLens is available in the Google Play Store for Android 6.0+ devices in the UK.