# Stars Looking A Bit Dim? Throw Some Math At Them.

As the cost of high-resolution images sensors gets lower, and the availability of small and cheap single board computers skyrockets, we are starting to see more astrophotography projects than ever before. When you can put a \$5 Raspberry Pi Zero and a decent webcam outside in a box to take autonomous pictures of the sky all night, why not give it a shot? But in doing so, many hackers are recognizing a fact well-known to traditional telescope jockeys: seeing a few stars is easy, seeing a lot of stars is another story entirely.

The problem is that stars are fairly dim; a problem compounded by the light pollution you get unless you’re out in a rural area. You can’t just brighten up the images either, as that only increases the noise in the image. A programmer always in search of a challenge, [Benedikt Bitterli] decided to take a shot at using software to improve astrophotography images. He documented the entire process, failures and all, on his blog for anyone else who might be curious about what it really takes to create the incredible images of the night sky we see in textbooks.

In principle it’s simple: just take a lot of pictures of the sky, stack them on top of each other, and identify which points of light are stars and which ones are noise artifacts. But of course the execution is considerably more difficult. For one thing, unless the camera was on a mount that was automatically tracking the sky, the stars will have slightly moved in each image. To help with this process, [Benedikt] used a navigational trick that humanity has relied on for millennia: mapping constellations. By comparing groupings of stars in each image, his software is able to accurately overlay each image.

But that’s only one part of the equation. In his post, [Benedikt] goes over the incredible amount of math that goes into identifying individual stars in the sea of noise you get when a digital image sensor looks into the black. You certainly don’t need to understand all the math to appreciate the final results, but it’s a fascinating read for those with an interest in computer vision concepts.

This kind of software is precisely what you want to pair with your 3D printed star tracker, or even better a Raspberry Pi sky monitoring station.

[Thanks to Helio Machado for the tip.]

## 16 thoughts on “Stars Looking A Bit Dim? Throw Some Math At Them.”

1. Cool, maybe they can find a gray-scale CCD sensor (without color tile upscaling algorithms), and add a mechanical shutter to capture blank-screen samples before and after actual image exposure for Flat-field correction:
https://en.wikipedia.org/wiki/Flat-field_correction

Also, depending on the driver one can sometimes play with image sensitivity by disabling auto-exposure control:
apt-get install v4l2ucp gphoto2

There are also inexpensive high-end cameras that can tether over USB for image capture.
Supported cameras:
http://www.gphoto.org/proj/libgphoto2/support.php

=)

1. RFP-A says:

Did yo hear the devastating news?
“On June 4, 2018, Microsoft announced its intent to acquire GitHub for US\$7.5 billion.”

1. TGT says:

I don’t think they’ve tainted some obscure star tracker code just yet. But yeah, it is a bit of a bummer.

1. Ren says:

yeah, if the code is useful to you, just download it and store it locally.
Or as the TV ad man says,
“Don’t Wait! Act Now! Supplies Are Limited! Operators Are Standing By!”

2. RFP-A says:

I expect all kinds of spying and tricks to force you to use MS backbones and libraries.
Also for it to become a more cumbersome setup.
And eventually to be sold off again leaving things in tatters.

Just like google code did I guess

3. Ren says:

“I don’t think they’ve tainted some obscure star tracker code just yet. ”

Well… if last week’s code compiled to 8 Mbytes, and this week’s code compiles to 88 Mbytes, MS might have tainted the code.

B^)

2. rnjacobs says:

At first I was going to ask why he didn’t just model the earth’s rotation to figure out how to stack the images … and then I actually read his write up and this is far more interesting.

3. Alan says:

Pincushion / barrel camera lens distortion is ignored, but the results are still excellent.

I’d sure like to see the source code for this one.

4. tyler says:

tried that, gravity through it back, still have the scar

1. RFP-A says:

threw*

5. M Tate says:

Hmmm I have this old Lytro camera…

6. RFP-A says:

Here’s an interesting bit:

“While working on this, I was also playing with an interesting idea for a future project: Only in a few places in the processing pipeline did we assume that all images were taken by the same camera. Additionally, we don’t require input frames to be very similar to each other – the alignment algorithm is robust enough to handle arbitrary camera orientation changes between images. This opens up an interesting avenue for a crowd-sourced stargazing service. It would ask people around the globe to upload night sky images to a website, and an algorithm behind the scenes would combine all of these images into a single, high-resolution star map spanning the globe.”

1. RFP-A says:

He does not seem to make code available though, so I expect this remains theoretical until someone else runs with it with his own software design.

2. You can definitely use that to track space rocks…sorry Hank, minerals.

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.