Point Me At The Sky: wall art using Raspberry Pi camera images

I have a long-running Raspberry Pi camera project to capture images of the view from a window (more details here). A recent post on mastodon, which showed a keogram, encouraged me to take my PiCam images and turn them into art.

The finished product

This is the finished wall art, printed on canvas. Ready to hang on the wall.

It shows images of the sky over two-and-a-half years (see below for details). The modulation comes from the length of daytime which is shortest in winter and longest over the summer, here in the northern hemisphere.

How did I do it?

The camera has been capturing images every 10 min from 3am to midnight (yes, I do regret not doing it ’round the clock) since late 2018. So at the time of writing I have four years and two months of images. The camera is pointed out of a window at the horizon. The top third of each image contains the sky.

I modified a previous script I had written so that I could load each image and from each one, excise the sky, find its average RGB value and store that in a matrix. This gave me an initial image like this:

The four swellings you see are 2019, 2020, 2021 and 2022 where the image ends on New Year’s Eve. The grey parts are where there is no data (the stripes indicate a camera outage of more than a day). Each pixel is a 10 min window.

This display is too wide for a commercial printer. The most extreme ratio for a canvas wrap that I could find was 12″ x 30″ so I needed to think of ways to change the size of the image.

I opted to truncate the data, so that it would fit more easily. I wanted to make the image taller so that each time point was 2 pixels tall by 1 pixel wide. These steps were all possible in Fiji.

This gave something close to the right size, but it still needed padding. I was missing 00:00 to 02:50 for each day and so I padded using black pixels in a way that centred the daylight images. This was done to match the final image ratio, with no resampling. Finally, I “repaired” the grey lines by interpolation (hey, it’s art, not a scientific figure). Giving this image:

To scale up I generated a 300 dpi image by bicubic scaling to a size of 30″ wide by 12″ tall.

This display shows that we do have some blue sky days here in Great Britain, but most days are cloudy and appear white. A limitation here is that the camera is pointing due west. A camera pointing straight upwards would be a better method (and is how to make a true keogram). A second limitation is how to represent the sky as a single RGB triplet at each timepoint. The method I am using here is OK, but it de-emphasises the moon, which can be seen to traverse the sky in the single images. It is possible to just about make out small white streaks in the black area of the image that coincide with close-to-full moons. Full-sky capture and a different algorithm would improve the night time images quite a bit.

In the end, I’m quite happy with how it turned out.

Some final details for nerds

To give you some idea of the scale of data involved. The images are 3280 x 2464 jpegs and vary in file size according depending on the time of day. One year of images is just under 46,000 images and can be archived as tar.gz of approx 125 GB. So the project is currently over 0.5 TB. The data is stored on a NAS (backed up, yada yada), details of how that is all set up and how I set up alerts about downtime can be found here. I store the single images in directories corresponding to year. This makes it easier to navigate and work with directories.

To work with the images, I pulled them down to my laptop by first ssh-ing to the NAS, generating a gzipped tar of each directory and then downloading via a cable. After expansion, I could use the script to generate the matrix, working one year at a time, exporting a tiff and then stitching them together in ImageJ.

To find the average colour of the sky, I take the sum of the squares of each channel’s values and find the square root.

The post title is taken from “Point Me At The Sky” by Pink Floyd. It’s a rare single from 1968, not featured on any album. It is included on Volume 2 “1968 Germin/ation” of The Early Years 1967-1972 box set.