Astrophotography suggestion FWHM algorithm
Posted: Thu Aug 21, 2014 4:01 am
Let's start off by stating that I love your program. It has been rock solid for my astrophotography work and that is what I exclusively use the program for. I have not used the scripting yet...but I can tell that I will soon. Pseudo FWHM (Full Width @ Half Maximum) calculation for the liveview window. I just finished doing this calculation for a program I wrote and it works very well for focusing my telescope. Here's the basic idea:-Have the user enable FWHM indication via a checkbox of some sort. The user then needs to position their mouse over the liveview window and right-click where they want the FWHM calculation to be centred.-Once this is done you would continuously grab a 30 x 30 pixel or maybe larger region of the liveview data stream that was centred on where the user clicked. You would then perform the following calculations...all parameters should be floating point just to ensure truncation errors are minimized.a)Convert the RGB color values to monochrome using a simple R + G + B calculation. Now, for each pixel, you will have converted the three 0-255 RGB values into a single corresponding 0-765 monochrome value.b)Next you would sort all 900 (30 x 30) monochrome values from highest to lowest. Make note of the highest and lowest monochrome values.c)Calculate a threshold value = [Highest + Lowest]/2. Note that the Lowest value is typically not equal to zero. d)Next you would count up all the monochrome values that are equal to or greater than the threshold value...this count value will range from 0 to 900. Rather than calling this value the FWHM, I call it the "StarSize" in pixels. It is loosely based upon the FWHM calculation...but good enuf for astrophotography focusing needs.e)I also perform a simple lowpass filtering of the count value which takes advantage of the liveview update rate to give a count value that has the ability to display fractions of a pixel. Here is the equation:FilteredCount(n) = [Count(n) + K x FilteredCount(n-1)]/[K+1] ;all values should be floating point numbersDefinitions:FilteredCount(n) = This is the filtered starsize value that is to be displayed to the user.Count(n) = This is the count of the number of pixels whose monochrome values were larger or equal to the threshold value.K = Smoothing factor...values of 10 or 20 are great...this value can be any positive value...higher values cause heavier filtering.FilteredCount(n-1) = This is the value of FilteredCount(n) that you got from the last pass thru this algorithm. You can initialize this value to zero for the very first pass thru the algorithm.The astrophotographer will use this feature by turning on liveview and positioning a bright star into the camera's field of view. Next they will select this "StarSize" feature and position their mouse directly over the bright star and click. The "StarSize" calculation will then begin updating it's "Starsize" value which is scaled in pixels. The astrophotographer will then focus their telescope while watching for the "Starsize" value to be minimized. Once the "Starsize" value is minimized the telescope focus will be optimized. The only caution to give the astrophotographer is that only one bright star should be contained in the 30 x 30 pixel region of interest. This is normally not an issue.