Page 8 of 9

Astrophotography suggestion FWHM algorithm

Posted: Thu Aug 21, 2014 4:01 am
by Wolsley
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. 

Thanks a very good

Posted: Thu Aug 21, 2014 7:53 pm
by Duka Istvan
Thanks a very good explanation, do you can post some code with implementation?. 

Pseudo FWHM code

Posted: Thu Aug 21, 2014 10:44 pm
by Wolsley
Duka,I program exclusively in a language called LabVIEW.  It is an entirely graphical programming environment so I can't show you any example C+ text code.  I will try to put something together soon to demonstrate my implementation.  I need clear skies to capture screen data with my telescope.

I don't have any device to

Posted: Fri Aug 22, 2014 12:05 am
by Duka Istvan
I don't have any device to capture stars so some example image will be good too, to test if i'm in right way

Pseudo FWHM Star Size Indication

Posted: Fri Aug 22, 2014 10:46 pm
by Wolsley
Istvan,I put together a pdf document that explains my usage of this pseudo FWHM idea.  It also includes an optimized algorithm that should make implementation easier...enjoyPeter

Check this version: https:/

Posted: Sat Aug 23, 2014 9:21 pm
by Duka Istvan
Check this version: ... .1.808.exe i try a first implementation, please check it. 

Starsize Indicator

Posted: Mon Aug 25, 2014 4:48 pm
by Wolsley
Istvan,It looks great.  I was able to call up a photo of some stars on my screen and then point my camera with a 15-55mm lens attached and get the Astro Liveview displayed.  I was then able to click on the liveview to locate the region of interest, zoom in as desired, adjust the starsize window and use the manual focus buttons on your screen to focus the camera.  Excellent work.  The indicated starsize should only have 1/10th pixel resolution [XXX.X]  The extra decimal places jump around too much in a live display.  I attached a jpg screen capture. I have some other suggestions for your Astro module.  I hope you don't mind.  I will put them together as a PDF and send it to you soon. Once again...great work...I hope this feature wows the astrophotographers Peter

Suggestions for Astrophotography features

Posted: Mon Aug 25, 2014 11:22 pm
by Wolsley
Istvan,I'm going to hope that you are ok with my "wish list".  I took the time to put together my thoughts.  If you want help in testing anything just let me know.

I made some improvements on

Posted: Tue Aug 26, 2014 9:38 pm
by Duka Istvan
I made some improvements on astro UI : ... .1.810.exe

Feedback on your updates

Posted: Fri Aug 29, 2014 11:50 pm
by Wolsley
Istvan,Great updates on Version 1.1.810.0  Only thought I had would be to also duplicate the PHD Guiding button you have on the mainscreen onto the Astro Bulb screen.  I did some research with my PHD Guiding server program and verified that the GUIDE button on your PAUSE RESUME DITHER MOVE GUIDE screen does not function.  I read on the PHD Guiding site that the GUIDE command is not implemented.  Please let me know if you want me to help test anything.