Easy 2D Signal-to-Noise Ratio (SNR) calculation for images to find potential stars without extracting the background noise (C++)

Long story short - I was looking for a way to detect more or less reliably if a user selected a region which contains a star. I wanted to be able to clearly distinguish between the following two images:

After a long journey I finally ended up with the following working solution based on the CImg library:

For the two images above the code gives the following results:

For many people this is where the journey ends. But for some of you it may just begin 🙂 Follow me into the rabbit hole and find out why the solution shown above actually works…

Continue reading →

Finding perfect focus with V-Curve fitting based on a hyperbolic function

This article is about finding the best possible telescope focus by approximating a V-Curve with a hyperbolic function. A V-Curve is the result of moving the focus of a telescope from an outside focus position into the focus and then further into the same direction out of focus again. As probably not surprising this curve is called V-Curve since it is similar to a V. The focus can be measured using different measures - for example the "Half-Flux Diameter" (HFD) or the "Full width at half maximum" (FWHM). In this case the HFD is used. This way a V-Curve comes into existence where the focus position is shown on the x-axis and the focus measure (HFD) on the y-axis (right figure).

Continue reading →

Connecting a C++ Process to the Web

End of last year me and my colleagues had the chance to submit a paper to the 19th "Methods and Description Languages for Modelling and Verification of Circuits and Systems" workshop (in German "Methoden und Beschreibungssprachen zur Modellierung und Verifikation von Schaltungen und Systemen" - in short MBMV). This year the conference took place at the University of Freiburg.

Our paper with the title "Connecting a C++ based Structural Verification Tool to the Web" describes an approach of how a C++ application can easily be connected to the web. In short - a web server and Continue reading →

Night sky image processing - Part 7: Automatic Star Recognition

In the parts 1-6 of my "Night sky image processing" Series I wrote about the different stages of night sky image processing. In this article I want to put all the pieces together and develop an "automatic star recognizer" which takes an astro-image as input and outputs a list of the recognized stars with their HFD and FWHM values.

Basically the processing pipeline is as follows:
ROI = Region of interest

In order to achieve this I use most of the concepts I have looked into earlier: As input I used the following FITS image for testing. Continue reading →

Night sky image processing - Part 6: Measuring the Half Flux Diameter (HFD) of a star - A Simple C++ implementation

In Part 5 of my "Night sky image processing" Series I wrote about measuring the FWHM value of a star using curve fitting. Another measure for the star focus is the Half Flux Diameter (HFD). It was invented by Larry Weber and Steve Brady. The main two arguments for using the HFD is robustness and less computational effort compared to the FWHM approach.
An article about the HFD can be found here. Another short definition of the HFD I found here. The original paper from Larry Weber and Steve Bradley can be found here.

Let's start with the definition: "The HFD is defined as the diameter of a circle that is centered on the unfocused star image in which half of the total star flux is inside the circle and half is outside."
This definition can also be written in a mathematical fashion:

  • is the pixel value minus the mean background value (!)
  • is the distance from the centroid to each pixel
  • is the number of pixels in the outer circle
  • is the Half Flux Radius for which the sum becomes
I decided to put the formula here because it makes it easier to explain what is going on. In contrast to the definition in the other article I decided to name Half Flux Radius () instead. This is because Continue reading →