AuroraAlert using Kiruna All-Sky camera

present sky over Kiruna

aurora on 16th Mar 2007

The Swedish Institute of Space Physics, the Institutet för rymdfysik, provides a recent digital image of the Kiruna sky at 6750.52N latitude, and 2024.63E longitude. For people living in the city and interested in seeing the aurora borealis, this is a useful service. In the beginning, an aurora is typically too weak to be seen from the city. The all-sky camera of the institute, however, is installed away from the lights of Kiruna and detects the phenomenon in the upcoming.

To this service, we add a software that acquires the most recent image from the Internet and analyses it automatically. If areas of green or red light are detected, a pleasant sound will be played to notify the user. This way, people interested in seeing the aurora do not have to monitor the website of the institute manually but will be informed in time, nevertheless.

Java is ideal for this project. Our program consists of a thread, which loads and analyses an jpg-image from the web once a minute. (This is the frequency by which the image is updated by the institute.) If the rating of the current image is above a certain threshold, the program assumes there is an aurora in the sky. The value is proportional to the fraction of certain green and red hue in the photograph. The aurora is detected in its early stage - upon which audio feedback is launched.

As shown in the test images aside, the program ignores daylight, and clowds successfully. A green laser beam, which occasionally radiates from the institute, causes problems only when there are clowds.

When several people started using the software, we modified the program to read the aurora reference palette from a central server upon startup. This not only makes the package smaller, but also allows us to adjust the functionality without having to distribute updates. The image processing is tuned in MATLAB and remains under development.

The Kiruna All-Sky camera was installed by Urban Brändström in 2001. He encouraged me to give all details on AuroraAlert, which I do in the next sections.

Program, including sound * 110 kB
Aurora palette (binary format) 120 kB
Source (Java 1.5) 4 kB
* Alexandru Pandele communicated the problem to me.
Performance of AuroraAlert
Smooth seas do not make skillful sailors.
African Proverb

Triggering the alert

Upon launch, the Java program retrieves the recent version of the auroral colorset from the Internet. The configuration file of AuroraAlert is currently hosted by a server in Würzburg/Germany. The file contains the palette of the following 28602 colors:

Then, the program enters the main loop: Roughly each minute, the most recent photograph of the Kiruna All-Sky camera is downloaded from the IRF server. In this image, we count the pixels that have a color that also appears in the auroral colorset. The sum is divided by the total number of pixels for normalization, and multiplied by a certain factor for amplification (currently 200.0). If the result is greater than a threshold (typically 1), the acoustic alarm is triggered.

We introduce the variables

The image is considered to feature an aurora if


When the program is running, all relevant information is displayed in the console. We show the output of the program launched on April 1, 2007 at 23:31:40.

 factor == 200.0
 colors #= 28602
2007-Apr-01 23:31:49 => 0.17028
2007-Apr-01 23:32:49 => 0.16956
2007-Apr-01 23:33:49 => 0.33289
2007-Apr-01 23:34:49 => 0.42187
2007-Apr-01 23:35:50 => 1.12181
2007-Apr-01 23:36:50 => 3.17433
2007-Apr-01 23:37:51 => 5.21441
2007-Apr-01 23:38:54 => 5.18229

Some notes on the implementation:

Distilling the auroral colorset

In the all-sky image, the Java program determines the fraction of pixels that have a color that also appears in a predefined colorset. If this fraction is above a certain threshold, the image is considered to feature an aurora. Therefore, the colors in the predefined colorset should relate to the colors of an aurora. The predefined colorset is coined auroral colorset.

Ultimately, the human decides best, if an aurora is visible on a digitized photograph. Using all-sky images from the IRF archive of the past years, we make up a patchwork of image segments that show an aurora.

Auroral superset (image scaled by 75%)

Parallel to this, we manually classify 558 all-sky images that we have downloaded from the IRF archive into three categories:

From the auroral superset we remove all colors that appear in 3 or more images that are classified as not featuring an aurora. We use MATLAB to distill the auroral colorset from the auroral superset in this way. We choose a threshold of 3 to make the algorithm robust to the imperfections in the classification.

Finally, all 558 images that we have downloaded from the IRF archive are subject to testing. We rate the performance of the auroral colorset by visual inspection of the test images, in which we enhance the pixels that have a color that also appears in the auroral colorset.

Possible improvements


Before the next Winter takes possession of Kiruna, we suggest to consider the following:

It is no use saying 'We are doing our best.'
You have got to succeed in doing what is necessary.
Winston Churchill