Have you taken a sky photo with the hackAIR app? Are you curious how the app estimates the air quality, based on your photo? Do you want to know more about the science behind this feature?

Even with your bare eyes, you can see that the cloudless sky is not always the same blue. The color of the sky changes with the time of the year and time of the day, but it also changes when particles are present in the atmosphere. In very polluted cities the sky often does not appear very blue, while it can be deep blue when it has rained recently and it is very windy and it can also be deep blue in remote locations.

The feature

Once you have taken a sky photo with your hackAIR mobile app, the image is uploaded to the hackAIR server where we analyse the colour of the sky and estimate the current air quality. When the calculations have completed, the picture is shown on the hackAIR map with an estimate of the air quality.

Behind the scenes

  • Step 1: A computer algorithm detects the portion of blue sky in the photo. As the lower parts of photos often show buildings or landscape, this part is discarded by the hackAIR system. From the recognised sky, the upper third is used for further analysis.
  • Step 2: Using the average colour detected, hackAIR then calculates the ratio between red and green light bands (R/G ratio).
  • Step 3: We then look up this ratio in a table that lists the corresponding air quality value in relation to the location and time of day at which the photo was taken.
  • Step 4: The estimated rating of the air quality, together with the photo, is shown on the hackAIR platform.

The scientific background

The main idea is that the ratio of red and green band of the light (R/G) depends on the amount and type of aerosols in the atmosphere (R/G increases with increasing AOD).

Aerosols, which are tiny particles suspended in the atmosphere, are emitted by natural (e.g., volcanoes, desert dust, forest fires, sea salt) as well as human activities (e.g., biomass burning, combustion of fossil fuel, industrial activities). Aerosols affect the levels of surface solar radiation by scattering and absorbing the light coming from the sun reducing the visibility in the atmosphere.

By measuring the radiation that reaches the ground at specific wavelengths we can assess the degree to which aerosols prevent the transmission of light by absorption or scattering. This is expressed as aerosol optical depth (AOD). AOD is unitless and usually reported at a wavelength of 550 nm. A value of 0.01 corresponds to an extremely clean atmosphere (air quality = very good), and a value of 0.4 would correspond to a very hazy condition (air quality = bad).

To control for varying atmospheric conditions, we produced a set of look-up tables using a  radiative transfer model (RTM). RTMs calculate the intensity of the light transferred within the atmosphere under different user-input scenarios that include information about the position of sun (solar zenith angle) relative to Earth and various atmospheric parameters (e.g., clouds, aerosols, water vapour, ozone, surface albedo, etc.).

We then compare the measured light intensities with those expected conditions to retrieve an estimate of the current aerosol optical depth.

A similar approach has been used to examine the atmospheric effects of volcanic eruptions in historical paintings1. Instead of the painter’s eyes, hackAIR uses mobile images and publicly available images from Flickr and webcams. We performed a number of tests to check the effect of the camera type on R/G ratios – as previous studies indicate, this is not a major issue.

Future potential

This analysis of sky photos makes it possible to monitor air quality in urban and rural environments with easily available tools: digital and mobile cameras. This estimation of air quality supports citizens in collecting more valuable information about the quality of the air: e.g. in their neighbourhood, around schools, in busy streets.

hackAIR uses the sky photo analysis not only for images provided by users through the mobile app. This image analysis is also used by the hackAIR tech team to analyse a very large number of photos from Flickr and webcams.


1 Zerefos, C. S., Gerogiannis, V. T., Balis, D., Zerefos, S. C., and Kazantzidis, A.: Atmospheric effects of volcanic eruptions as seen by famous artists and depicted in their paintings, Atmos. Chem. Phys., 7, 4027-4042, https://doi.org/10.5194/acp-7-4027-2007, 2007.

Copyright 2021. All rights reserved

Take part in this short survey and help us improve your hackAIR experience.