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

How best to center full-disc solar images, from a python script?

  • Please log in to reply
5 replies to this topic

#1 KWhitt

KWhitt

    Lift Off

  • -----
  • topic starter
  • Posts: 16
  • Joined: 19 Dec 2022

Posted 21 March 2025 - 02:40 PM

How can I center full-disc solar images, from a python script?

 

 

What I'm trying to do (big picture):  Process a year's worth of (mostly) daily white light images of the sun, to use in creating a timelapse animation.

 

I'd love if there was a command line interface to PIPP, because the center and crop functionality it offers is otherwise exactly what I want. (I know PIPP can process multiple images at once, but I want to script the whole process so adding a new day's image to the animation requires as few manual steps as possible.)

 

I've tried centering based on average brightness, but the results aren't good enough.

 

I've dabbled with detecting circles with the opencv/cv2 Hough Transform, but haven't managed to tune the parameters to get the results I want yet.  Before I spend more time on that path -- is there something else I should try?

 

Thanks,

Kristie



#2 gmiller123456

gmiller123456

    Viking 1

  • -----
  • Posts: 889
  • Joined: 25 Dec 2020

Posted 21 March 2025 - 02:49 PM

Using OpenCV, I'd start by doing a threashold to separate the background/foreground into black and white, then play with blob detection to find the center of the biggest blob.



#3 KWhitt

KWhitt

    Lift Off

  • -----
  • topic starter
  • Posts: 16
  • Joined: 19 Dec 2022

Posted 21 March 2025 - 02:56 PM

Ooohhh, threshold sounds promising.  Where my efforts have been inadequate so far seems to be from a slight gradient outside the disc, at least sometimes due to haze--a threshold would definitely help there.  I don't know much about blob detection, but I didn't know about Hough circles before today, either, so that part doesn't worry me.

 

Thanks!



#4 RobertJ

RobertJ

    Mariner 2

  • -----
  • Posts: 253
  • Joined: 06 Oct 2007
  • Loc: Israel

Posted 21 March 2025 - 02:59 PM

This might have what you're looking for - either use the tool entirely, or be... inspired... by the code ;)

 

https://github.com/GregAlt/SolarFinish (fantastic tool!)

 

The author posts here

 

-- Robert



#5 spicerack0

spicerack0

    Mariner 2

  • -----
  • Posts: 285
  • Joined: 30 Sep 2024

Posted 21 March 2025 - 03:09 PM

go on xai and just ask grok to write you a code to center all your images around the center of contrast.

 

link to the response and sample code here- https://grok.com/sha...1c-fe7350c2f56a


Edited by spicerack0, 21 March 2025 - 03:11 PM.


#6 KWhitt

KWhitt

    Lift Off

  • -----
  • topic starter
  • Posts: 16
  • Joined: 19 Dec 2022

Posted 26 March 2025 - 12:39 PM

This might have what you're looking for - either use the tool entirely, or be... inspired... by the code wink.gif

 

https://github.com/GregAlt/SolarFinish (fantastic tool!)

That tool looks great, thanks!.  I'm away from home (and my data), but I'll have to give it a try on my h alpha stuff when I get back.

 

As for my centering, I gave the Hough circles another try and got parameters that work on my set of test images.  Full run on all my data when I get home again.

 

My next wish is that TlitingSun had a command line option, so I could figure out how much to rotate each SeeStar image so that solar north is up.  I can get the value of P from the sunpy package, but I'm puzzling over the N-S meridian tilt value.  All my searches keep giving answers to questions I'm not asking (ex: how to calculate the declination of the sun, or how to calculate the hour angle of the N-S meridian), and I don't know enough to build this up from scratch.  It looks like the SolarFinish tool does rotation by matching to a known image, which is clever!--but I'm determined to do it by math (I also don't know that would work with white light images).




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