The question
Can a photo of the sky estimate air pollution, and how would you know if it could?
Fine particles in the air (PM2.5) scatter sunlight. That has three visible effects: distant detail loses contrast, the sky's blue washes out towards white, and the horizon blurs. The more particles, the stronger each effect, which is why visibility falls as pollution rises. Gases are a different story: nitrogen dioxide can tint the sky faintly brown, sulphur dioxide even less, and carbon monoxide and ozone are invisible. So I expect a photo to track particulates reasonably well and gases poorly. Finding where the method breaks is part of the result.
What I did
I built an iPhone app and a website that test that question on every scan.
How a scan works
- Capture. Three frames are taken and combined pixel by pixel using the median, which throws out a single bad frame (a bird, a glare flash) instead of blending it in.
- Observe. Google's Gemini vision model rates the photo on fixed 0–1 scales: haze, sky blueness, horizon sharpness, colour tint, cloud cover, likely fog. It is forbidden to judge pollution; it only describes what it sees.
- Judge. My scoring model does the judging, transparently, and maps the result onto the six standard air-quality bands (Good below 15 … Hazardous above 90).
- Check. The app fetches the nearest government sensor's reading (OpenAQ) and stores the prediction and the truth side by side, without the photo.
How I test it
A pair only counts if the sensor is within 10 km and its reading within 60 minutes of the photo. I measure Spearman rank correlation (does a worse-looking sky mean worse air?), a confusion matrix (where predictions go wrong), and exact and within-one-band accuracy. Fog is analysed separately, because it looks like pollution but isn't. The weights above are my starting hypothesis; once there are enough pairs (target: about 100), I refit them from the data and see whether the fitted model beats my hand-set one.
Phone app vs website
Both run the same scoring model, kept identical by a shared settings file and 12 shared test cases, and both feed one dataset. The important difference is camera control.
- iPhone app: an installed app that always locks camera exposure and white balance before capture, and logs ISO and exposure time on every scan.
- Website: works in any phone browser with no install, but can lock the camera only on some Android phones, and never on iPhone, where every browser uses Safari's engine. It talks to Gemini through the website's own server, so the access key never reaches the browser.
A camera left on automatic adjusts itself to each scene, which can make a hazy sky and a clear sky look more alike than they are, flattening the very signal being measured. Rather than hide this, every scan records how it was taken, and the analysis compares accuracy for each mode. That turns a weakness of the website into a second question: how much does locking the camera actually improve accuracy?
Privacy and credits
Photos are never stored, locations are rounded to about 110 m, and contributors can opt out. I am not a programmer: the code was written with Claude Code, and I credit that openly. The question, scoring model, test design and interpretation are mine.