Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

Solar Eclipse Image Processing / ACHF FNRGF

93 replies to this topic

#1 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 19 August 2023 - 11:37 PM

Hi everyone, this is my first post in cloudy nights.

 

In 2017 I saw images solar eclipse images Druckmüller (image attached below) and I was hooked, I decided that when the next eclipse come (in 2024 ) i will be ready.

 

Druckmüller explains how to align and enhance solar eclipse images in a series of paper (here is the link to the first paper: https://www.research...aphy_processing). His daughter wrote a thesis that explain the process very well (here is a link the short version: https://www.vut.cz/w...file_id=81226).

 

I thought I could code the algorithm but I hit a road block. I got the first part working, I coded in matlab the fast Fourier convolution (called phase correlation in the paper) to perform sub pixel alignment of bracketed solar eclipse images, it's beautiful. But now I am stuck, i can't implement the ACHF nor the FNRGF algorithms to enhance images.

 

Anyone who would like to collaborate, please add a post to this thread. I am sure that together we can make it happen.

 

I will be happy to share what i have.

 

Best,

 

Francois

 

PS: i am not attached to Matlab, code could easily be written in Phyton or other programing language.

 

post-468546-0-24470600-1692411993.jpg


  • Robin, dan_hm, j.gardavsky and 1 other like this

#2 dan_hm

dan_hm

    Apollo

  • *****
  • Posts: 1,251
  • Joined: 31 Dec 2012
  • Loc: Queens, NY

Posted 20 August 2023 - 12:28 PM

Great topic.  I know nothing about coding but would love to see something like this accomplished.

 

And FYI neither of the links work.



#3 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 20 August 2023 - 12:38 PM

i did not realize the links don't work,  you can contact me for the links a y e l l o f r a n c o i s @ h o t m a i l c o  m



#4 DelVento

DelVento

    Sputnik

  • -----
  • Posts: 28
  • Joined: 26 Aug 2022

Posted 21 August 2023 - 07:23 AM

Hey Francois,

 

Great picture and thanks for posting. I am a physicist and I also worked as a software engineer. Matlab is nicer than Python for some things, but for a project like this (which I guess we want open source for everybody to see/use/improve) python or julia would be better.

 

I would consider collaborating with you on this project and I will send you an email about it (and the missing links).

 

Cheers!


  • R Botero likes this

#5 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 21 August 2023 - 04:05 PM

i like the idea, I started with Matlab because i am used to it

 

but Google Colab is great to share. and if we use python we can use Open CV


  • GregAlt likes this

#6 banjo1000

banjo1000

    Vostok 1

  • -----
  • Posts: 109
  • Joined: 16 Apr 2017
  • Loc: Fort Collins, Colorado

Posted 22 August 2023 - 01:54 AM

I am interested to keep track on these Dr y,
Joe Izen
  • Francois314 likes this

#7 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 22 August 2023 - 03:02 AM

This is great Joe, feel free to send me an email. I’ll make a group so we can share info easily

#8 PI_CO100

PI_CO100

    Sputnik

  • -----
  • Posts: 39
  • Joined: 31 Dec 2008

Posted 05 September 2023 - 07:59 AM

Count me in! :-)



#9 Jhillphotos

Jhillphotos

    Sputnik

  • -----
  • Posts: 34
  • Joined: 12 Jun 2019
  • Loc: Birmingham, AL

Posted 17 September 2023 - 11:03 PM

Count me in! I'm down to collaborate on this project.

#10 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 01 October 2023 - 08:44 PM

we are far from being done, but here is what we learned so far:

 

doing the phase registration and alignment is relatively easy, but there are a few tricky things to address. here is a barebone version of my function, i removed all the fluff so you can easily see the logic (forgive the spelling mistakes):

 

Screenshot-2023-10-01-180740.png

 

here are the important things for the alignment to work

  • use cropped version of the pictures (small crop around the sun), it will simplify things later
  • i did not see a benefit in using a high pass filter before performing the phase correlation (as recommended by Druckmüller)
  • you will get two peaks, on for the sun and another for the moon (the moon makes for the largest peak and must be ignored, see picture below)
  • if you use less than 200mm focal length (like i did it 2017 crazy.gif  , then don't worry about it)
  • if you take pictures quickly (i.e., the moon does not have too much time to move compared to the sun) then both peaks will be blurred and it's difficult to know which one is for the moon and for the sun (using Davide's pictures both peak where only 1-2 pixel apart).

Untitled.png

Here if for the quick update, sub pixel alignment is still not ready, but coming soon smile.gif , we will keep you updated in a few weeks.

 

before leaving i need to thank:

  • Davide, thanks for meeting with me and sharing pictures !!!!
  • christian viladrich for sharing solar eclipse pictures with me, go check his website, he is really good http://astrosurf.com...egypte2006.html
  • Ryan Eustice for sharing his matlab library: UWIT: Underwater Image Toolbox for Optical Image Processing and Mosaicking in MATLAB, it does the subpixel image alignment perfectly, including rotation and scaling! (this will be important when we will be aligning pictures at different focal length, but we are not there yet)

  • Robin and R Botero like this

#11 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 05 October 2023 - 08:09 PM

Here is today's update. 

 

I am trying to improve the FFT convolution by remove the signal coming from the moon. I think there are 2 options: we can (1) remove the moon entirely (i.e., fill it with white light to match the corona) or (2) blur the moon’s edge so that it’s does not register strongly in the FFT (just as Druckmuller suggest in his 2006 paper)

 

I used the method suggested in Sebastien Gava's master thesis (https://matheo.ulieg...E_Gava_2018.pdf) the Circle Hough transform, but results are not great.

 

aa.png

 

 

anyone has experience with circle/edge detection ? Sebastien explain another algorithm (Daugman circular integro-differential operator) but i do not understand it.


  • rslobins likes this

#12 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 13 October 2023 - 07:58 PM

code is slowly improving the Hougth transform is finally working we have a perfect circle around moon (necessary to remove the moon and apply a blur at the edge of the moon), high pass filter was improved using a gaussian high pass so there are no ring (artefacts) that used to mess up the FFT convolution

 

aaaabbb.png

 

pixel level alignment works 90% of the time, but not evetime. I think we need to find a good way to improve contrast to increase the signal of the sun's corona without increasing the signal from the moon


Edited by Francois314, 13 October 2023 - 08:00 PM.

  • moshen, R Botero and rslobins like this

#13 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 18 October 2023 - 10:00 PM

today's update, after fixing the Hough transform and blurring the edge of the moon (so it does not register too strongly in the FFT), sub pixel alignment was still not working. that is until Davide sent me one of Hanna D's paper. She mentioned using a low pass filter to remove noise, i was using a high pass filter to increase signal (but noise too). I switched the high pass filter for a low pass filter and both pixel and sub pixel alignment are working! (see the last two pictures, FFT convolution is much much cleaner).

 

here is a picture showing the process

(1) edge detection (don't use canny, it's too good and detect too many edges, use a regular edge detection algorithm like sobel)

(2) Hough transform to find the exact pixel coordinates of the moon

(3) low pass filter

(4) create a gaussian mask and used to both remove the moon and blur the edges.

 

here is what it looks like:

 

Untitled.png

 

FFT convolution for pixel level alignment and interpolation for sub pixel alignment

 

Untitled.png

 

Untitled.png

 

Next Task, Image calibration to create an HDR image, Jonathan we count on you ! 


  • R Botero, rslobins and DelVento like this

#14 GregAlt

GregAlt

    Vostok 1

  • -----
  • Posts: 163
  • Joined: 23 Jun 2009
  • Loc: Seattle, WA, USA

Posted 19 October 2023 - 12:31 AM

This is all very interesting. I've been working on a similar project for processing Hydrogen-alpha full disk images. Not quite the same but maybe some similar tricks apply. I'm working in python using opencv. I gave up trying to get houghcircles to get accurate disk detection and switched to opencv's edgedrawing detectellipse.

After centering, I found a neat trick for enhancing contrast. After centering, I do a polar warp to unwind the sun into a rectangle with the limb a vertical line. Then I do a median filter in narrow slivers, and then invert the polar warp to get a disk again. The effect is a median filter with 1-pixel thick arcs as the kernel. I can then subtract that from the original image and stretch contrast before adding back.

Not sure if that would make sense for the corona, but it solved a lot of problems I was having with other attempts.
  • R Botero, rslobins and Spot On like this

#15 GregAlt

GregAlt

    Vostok 1

  • -----
  • Posts: 163
  • Joined: 23 Jun 2009
  • Loc: Seattle, WA, USA

Posted 19 October 2023 - 08:08 PM

Also, if you switch to python... FNRGF is implemented in sunkit_image and there are some examples of how to use it:
https://docs.sunpy.o...dial.fnrgf.html
 

 

The implementation is highly inspired by this doctoral thesis. DRUCKMÜLLEROVÁ, H. Application of adaptive filters in processing of solar corona images. https://dspace.vutbr...toralThesis.pdf.


Edited by GregAlt, 19 October 2023 - 09:01 PM.

  • rslobins likes this

#16 GregAlt

GregAlt

    Vostok 1

  • -----
  • Posts: 163
  • Joined: 23 Jun 2009
  • Loc: Seattle, WA, USA

Posted 19 October 2023 - 11:01 PM

After centering, I do a polar warp to unwind the sun into a rectangle with the limb a vertical line. Then I do a median filter in narrow slivers, and then invert the polar warp to get a disk again. The effect is a median filter with 1-pixel thick arcs as the kernel. I can then subtract that from the original image and stretch contrast before adding back.

I read up more on FNRGF. Fascinating how it seems I was thinking about similar goals in my solution, just approached from a different angle. Instead of mean, I use median, and instead of breaking into 100 or so arc sectors, finding means, and then fitting a curve, I find the median using the arc sector centered on a given pixel. The result is very similar, even if the math is very different. The piece I'm missing is that FNGRF uses the standard deviation as a measure of existing local contrast and uses that to adaptively normalize. For my method, I've just been using a constant scaling factor.

 

It's got me thinking... If I just calculate the standard deviation for each pixel along with medians, I could then scale contrast as a function of that value. I also wonder about my choice of median vs mean and how that impacts results for each. My choice was based on the idea that a prominence in a field of black will tend to have a median of black, and *that* is what I want to use as my base to subtract. I was worried about the mean being lifted by small bright things, or on the disk, pulled down by sunspots and filaments. But now I wonder what the implication is of mixing median with standard deviation. That's mathematically wrong, but so are assumptions with mean that pixels have a normal distribution.

Anyway, giving me some ideas about what to experiment with next.  


  • R Botero likes this

#17 GregAlt

GregAlt

    Vostok 1

  • -----
  • Posts: 163
  • Joined: 23 Jun 2009
  • Loc: Seattle, WA, USA

Posted 22 October 2023 - 01:45 PM

Turns out doing a std dev filter in python is pretty easy. Instead of my scalar constant contrast enhancement factor, I switched to dividing by a normalized std dev image, and I really like the results.  Note that I must carefully normalize to a reasonable range of 0.25 to 0.667 for 4x enhancement of flat areas down to 1.5x for high-contrast areas. Stddev image is 4th from the bottom:

 

Attached Thumbnails

  • 394831064_10159777217246334_6281621954066872492_n.jpg


#18 DelVento

DelVento

    Sputnik

  • -----
  • Posts: 28
  • Joined: 26 Aug 2022

Posted 22 October 2023 - 05:33 PM

Turns out doing a std dev filter in python is pretty easy. Instead of my scalar constant contrast enhancement factor, I switched to dividing by a normalized std dev image, and I really like the results.  Note that I must carefully normalize to a reasonable range of 0.25 to 0.667 for 4x enhancement of flat areas down to 1.5x for high-contrast areas. Stddev image is 4th from the bottom:

 

Not sure that I follow you, but wanted to point out, in case you missed it, that FNRGF (and its predecessor NRGF and the similar but in my opinion better ACHF) are intended for *coronal* images, not solar disk. IIRC, the best choice for that use case is NAFE.


  • R Botero likes this

#19 Robin

Robin

    Vostok 1

  • -----
  • Posts: 193
  • Joined: 14 Sep 2008

Posted 01 November 2023 - 03:18 PM

Hi everyone,

 

Thank you, Francois, for contacting me via personal message. This looks like a very interesting project! I used to write Matlab codes when I was a Ph.D. student, but I don't have Matlab any more. If you have some code to test, would it be possible to convert it to an .exe file?

If you need some eclipse raw files to test it, I'll be happy to share my raw files of the 2017 total solar eclipse. However, it is 4 GB of data, so I'd need to find a way to upload it somewhere.

I used these exposure instructions as a guideline to capture images with a Canon EOS 70D camera and a 60 mm aperture, 330 mm focal length refractor:

http://www.zam.fme.v...nstructions.pdf

 

Clear skies

 

Robin



#20 ch-viladrich

ch-viladrich

    Surveyor 1

  • -----
  • Posts: 1,567
  • Joined: 14 Jul 2013
  • Loc: France

Posted 01 November 2023 - 04:03 PM

Great job François !! I will take a closer look at it in preparation of the coming 2024 total eclipse ;-)

 

Regarding registration, one possible way to do it is to use the lunar disk for registration, and then apply an offset (X,Y) to take into account the relative motion between the lunar disk and the solar disk.

 

This might be more accurate, provide the lunar limb is not overexposed.



#21 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 21 November 2023 - 07:44 PM

you right aligning the lunar disc is easy, the hard part would be to calculate the offset (X,Y) 



#22 Francois314

Francois314

    Explorer 1

  • -----
  • topic starter
  • Posts: 52
  • Joined: 27 Jul 2023

Posted 25 November 2023 - 09:02 PM

quick update, our group meet tonight to review our progress. Next group meeting is Friday Dec 1st to review tone mapping and HDR processing. 


  • R Botero likes this

#23 ch-viladrich

ch-viladrich

    Surveyor 1

  • -----
  • Posts: 1,567
  • Joined: 14 Jul 2013
  • Loc: France

Posted 28 November 2023 - 05:55 AM

you right aligning the lunar disc is easy, the hard part would be to calculate the offset (X,Y) 

In fact, it is easy to calculate the offset :

- the relative motion between the lunar and solar disk in alpha is 0.25 arsec/s,

- in delta, it is variable, but the information is easilly found in tables, so the user can provide the value to the software,

- the scale of the image and orientation are also known by the user,

 

So, all of these data are input to the software.

 

Then the (X,Y) can be comptured based on these input and on the time tap of the images.

 

This is probably the most accurate method of image registration, as long as the lunar limb is not overexposed.


  • N-1 likes this

#24 Kranenburg

Kranenburg

    Lift Off

  • -----
  • Posts: 12
  • Joined: 06 Jun 2020

Posted 30 December 2023 - 04:00 AM

Hi, Francois,

 

Very interesting initiative!

 

I have imaged the 2017 eclipse and got this far with photoshop: https://www.flickr.c...157708807181381

 

I will be in the USA for the 2024 eclipse as well.

 

Unfortunately I have no experience with matlab or python, but perhaps a user friendly version could also be produced. I have a lot of raw data files if you would need test images.

 

Clear skies

 

Arnaud


  • FXM, R Botero and dan_hm like this

#25 pachacoti

pachacoti

    Lift Off

  • -----
  • Posts: 11
  • Joined: 31 Aug 2017

Posted 03 January 2024 - 02:18 PM

Hi Francois,

 

I didn't notice your post here until just now. Thank you for initiating such a campaign! I have been thinking about the same thing but just haven't been able to materialise the idea. So I'd would definitely get involved with the collaboration and will be very interested in your progress. Programming-wise I'm an IDL person, with some knowledge of Fortran and Python. Besides, I'll be more than happy to share you with my images of past total solar eclipses as samples for testing. Please count me in! I can be reached via (p a c h a c o t i [at] y m a i l [dot] c o m).

 

Cheers,

Pachacoti


  • FXM likes this



Reply to this topic



  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics