Recentering the disk of the Sun or Moon in eclipses

Recentering the disk of the Sun or Moon in eclipses

We recently (March 20) had a partial solar eclipse. At OAN we have very limited resources to do visual observing and to try to show a live view of an eclipse to the public. This time we bought a Celestron zoom ocular 8-24 mm, that includes a T2 mount for DSLR cameras, and T2 adapters for Canon and Nikon cameras. We already have a Coronado H∝ telescope, and among the staff at OAN we own different Canon and Nikon DSLRs. The idea was to show a live view of the eclipse through our eclipse web page, but weather conditions in Spain were horrible that day and it was impossible. Anyway, it was really nice to see the great interest of the people in the eclipse, and our web page became possibly the best of all Spanish web pages dedicated to the eclipse, reaching 75 000 visits the day of the eclipse and more than 200 000 in a few weeks around the date of the eclipse.

One of the main problems when showing a live view of the Sun was to recenter and crop the disk of the Sun, so that the disk seems static to the people watching it in the web page. For this task I prepared a little program to recenter and crop it, with many options like adding a few labels and upploading it directly to the server.

The program uses a simple algorithm to calculate the smallest enclosing circle for a set of points. The set of points are computed from the photo, taking the edges of the Sun (or Moon) disk and separating them from the background. Background separation is done in a very simplified way, good enough for eclipses, but not for other uses. In fact, since weather was poor a few tests that were possible showed that this separation did not work fine, since there was scattered light produced by the clouds and it was difficult for the algorithm to separate disk and background. In sunny conditions (with a background dark enough) the process worked as expected in the tests performed days before the eclipse. The algorithm, in fact, seems quite robust. The only weak point is that all points computed at the edge of the disk must be in fact there, even with one wrong point among 1000 correct ones the cropped image can be different from the expected one.


 

Previous image shows the before and after result of applying this process to an H∝ imagen taken with a Nikon camera. We did tests using both real H∝ and simulated images (using as reference an H∝ image, and also optical ones). Respect the simulated images, we tested this algorithm against a number of situations, from solar to lunar eclipses, different zoom scales, having the Sun disk partially out of the frame, and with/without background stars. All tests showed good results in the recentering algorithm, which allowed to obtain a video with the sequence of these eclipses. The images for these tests, with the Sun and Moon disk displaced respect the center, were generated using the JPARSEC library.

The following videos show the results of applying this program to the simulated sequences of the solar and lunar eclipses of 2015. Click on the links below the video frame to show each of them. The lunar eclipse sequence is created using the debug mode of the program, that shows the set of points around the edge of the disk used to later get the enclosing circle. As you can see, the algorithm is quite fast, processing a 10Mpx image in 0.5 seconds or less in modern PCs (with the debug mode activated the process is slower).

Solar eclipse H∝ / Lunar eclipse

The program is available for downloading at this url. It should work on all operating systems. A recenter.txt file is used for configuring the different options of the program, like input/output image, labels, the border to leave around the cropped image, file upploading, and many others. Two nice features are to obtain the date of the photo from the EXIF data of the JPG file using this library, and to uppload it directly to a server using the Jsch library. The hot pixel parameter controls the maximum size a star or image defect can have so that artifacts with a size less than this are not considered to lie at the edge of the disk.

Fortunately there is a transit of Mercury next year, so this work can still be of use. I also expect it to be useful for others with the same problem.

Discussion

Enter your comment
   ____   ___    ____   ____  _      __
  / __/  / _ )  / __/  /  _/ | | /| / /
 / _/   / _  | / _/   _/ /   | |/ |/ / 
/___/  /____/ /___/  /___/   |__/|__/
 
 
blog/recenter_sun_moon.txt · created: 2015/03/21 12:48 (Last modified 2018/11/21 11:20) by Tomás Alonso Albi
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki