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 →

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 →

Night sky image processing - Part 5: Measuring FWHM of a star using curve fitting - A Simple C++ implementation

In Part 4 of my "Night sky image processing" Series I wrote about star centroid determination with sub-pixel accuracy. Based on this centroid position the FWHM determination of the star takes place. The FWHM (Full Width Half Maximum) value is a measurement for the star width. In this part I write about the so called curve-fitting which is used to determine the FWHM value from such an image.
Note that for the following calculation and implementation the sub-pixel determination of the centroid is not considered. Let's say we want to determine the FWHM in x-direction (red line). There is of course also one in y-direction. Basically, what happens is:

  • The pixel lines through the centroid in x direction are extracted (those gray-level values usually form a Gaussian distribution - a "data-point" is defined as (x,y)=(pixel x-position, pixel gray-level value).
  • Based on those (x,y) data-points the 4 parameters of a Gaussian curve are determined so that the Gaussian curve and the data-points fit "as good as possible" - the algorithm used is the so called "Levenberg-Marquart" algorithm which tries to minimize the quadratic error between the data-points and the curve.
  • The result is a Gaussian curve i.e. a parameter set which describes the curve (c=center, p=peak, b=base and the w=mean width). One of those parameters - the mean width is the FWHM value.
The C++ implementation below uses the GSL (GNU scientific library) to make use of the Levenberg-Marquart algorithm. The primary application of the Levenberg–Marquardt algorithm is the least squares curve fitting problem. Imagine you have a set of data points Continue reading →