Solar animation automatic alignment tool - imgalt

these are all of the great references that our users have shared with others.

Moderator: marktownley

Post Reply
User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

Solar animation automatic alignment tool - imgalt

Post by GreatAttractor » Sat Apr 26, 2014 4:10 pm

New solar imaging season has started and I'd rather avoid the least pleasant aspect – manual alignment of tens of time-lapse animation frames. Fortunately I've recently found an elegant algorithm (http://en.wikipedia.org/wiki/Phase_correlation) for detecting image translation, which can be widely varying, the images severly cropped, in other words – exactly what we get after a few hour solar session with telescope buffeted by wind, drift due to imperfect polar alignment and lack of manual correction in time etc.

I've created a tool implementing this approach, and so far results are satisfying, both for white light and H-alpha.

before:
unaligned1.gif
unaligned1.gif (473.56 KiB) Viewed 5061 times
after:
aligned1.gif
aligned1.gif (527.92 KiB) Viewed 5061 times
before (animation by warpal http://astropolis.pl/topic/39586-slonce ... ntry533305):
unaligned2.gif
unaligned2.gif (853.73 KiB) Viewed 5061 times
after:
aligned2.gif
aligned2.gif (902.57 KiB) Viewed 5061 times

The program takes all BMP files (mono or color, 8- or 24-bit) found in input directory (folder), aligns them and saves with new names (with "_aligned" suffix). It's a command-line program, but can also be run directly without using the command prompt (console):

- either copy BMP files to be aligned into the the directory where imgalt.exe is located, then run imgalt.exe: output (aligned) files will appear in the same directory,

OR

- drag folder with input BMPs and drop it onto imgalt.exe icon; after a moment the aligned files will appear in whatever directory was current at the time (e.g. under Windows, when dragging the folder "d:\astro\sequence1", output images should appear in "d:\astro")

Detailed usage description and building instructions can be found in the README file.

Latest Windows version (imgalt.zip) and source code (imgalt-src.zip) can be found here:
http://stargazerslounge.com/blog/1400/e ... 54-imgalt/

Binaries and source code may be freely distributed and used for any purpose.
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

Re: Solar animation automatic alignment tool - imgalt

Post by GreatAttractor » Sat Apr 26, 2014 4:13 pm

The workflow I use:

- align animation frames (i.e. sharpened stacks) with imgalt
- open aligned frames in GIMP (File->Open as Layers...)
- crop (select area, Image->Crop to Selection, this crops all layers), equalize layers' brightness if needed etc.
- export (File->Export as..., choose GIF, use "As Animation" option)

If you have frames in format other than BMP, they can be quickly mass-converted in IrfanView (File->Batch Conversion/Rename...). If you only have an animated GIF you'd like to reprocess, it can be split into BMP frames in VirtualDub (open the GIF, then File->Export->Image sequence...).
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

User avatar
marktownley
Librarian
Librarian
Posts: 23913
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by marktownley » Sat Apr 26, 2014 6:09 pm

Good stuff! Thanks for this.

I'll let the thread get a bit of exposure in the main forum and then put it in the library in a day or so...
Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!

Wah
Im an EXPERT!
Im an EXPERT!
Posts: 338
Joined: Tue May 01, 2012 2:14 am

Re: Solar animation automatic alignment tool - imgalt

Post by Wah » Sat Apr 26, 2014 6:38 pm

Hi GreatAttractor,

I have roughly looked into the source code, I wonder why using the last frame as reference rather than the first frame as reference?

Thanks!

Wah!

User avatar
robert
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 2326
Joined: Fri Oct 14, 2011 1:49 pm
Location: Isle of Skye, Scotland
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by robert » Sat Apr 26, 2014 8:14 pm

Many thanks for sharing, it looks very interesting
Robert
images and animations http://tinyurl.com/h5bgoso
2018 images https://www.flickr.com/photos/69734017@ ... 1234171714
2017 images http://tinyurl.com/gvk9k3k
ED80. SW200. ES127. Celestron-150mm-PST mod
LS60PT-LS60F-B1200. B600-Cak. PGR-Ch3-IMX265

User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

Re: Solar animation automatic alignment tool - imgalt

Post by GreatAttractor » Sat Apr 26, 2014 8:26 pm

Wah,
Actually no single frame is used as reference. Translation is always detected between two subsequent frames. Indeed, the translation vector for n-th frame is always stored with respect to the first frame, but that's just for knowing what's the bounding box of all (translated) frames in the end. Then, on the second pass, each frame is loaded again, translated and padded to have the size of the bounding box. (In the next update I might add an option to automatically crop all images to the smallest common area instead of padding).
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

User avatar
swisswalter
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 17951
Joined: Thu Feb 06, 2014 4:28 am
Location: Switzerland
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by swisswalter » Sat Apr 26, 2014 10:37 pm

Hi Filip

that is fantastic and when I read you are planing to automatically crop the images to the smallest common aerea my hart jumped up. Please have me to have the Gamma or Beta Version at least ;)
Only stardust in the wind, some fine and some less fine scopes, filters and adapters as well. Switzerland 47 N, 9 E, in the heart of EUROPE :)

from 7 am - 7 pm http://www.nanosys.ch

from 7.01 pm - 6.59 am http://www.wastronomiko.com some times vice versa ;)

James0057
Im an EXPERT!
Im an EXPERT!
Posts: 200
Joined: Sun Feb 12, 2012 11:23 pm
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by James0057 » Sun Apr 27, 2014 2:59 am

SUNTASTIC animation ...great job !!

Wah
Im an EXPERT!
Im an EXPERT!
Posts: 338
Joined: Tue May 01, 2012 2:14 am

Re: Solar animation automatic alignment tool - imgalt

Post by Wah » Sun Apr 27, 2014 3:18 am

Hi GreatAttractor, what I mean should be "last / previous processed frame" vs. "first frame of the whole sequence".
I can see some shift in one of your demo animations, which should be caused by the current algorithm, can this be solved by using the first frame?
Or the rapid change of solar surface will destroy the accuracy of alignment by using the first frame as reference only?

Maybe you can consider giving user an option to choose using which algorithm :roll:

User avatar
Houghy
Almost There...
Almost There...
Posts: 655
Joined: Mon Jun 18, 2012 1:01 pm

Re: Solar animation automatic alignment tool - imgalt

Post by Houghy » Sun Apr 27, 2014 7:10 am

do they have to be BMP files - can the software handle Tiffs and jpegs?
Just Learning

User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

Re: Solar animation automatic alignment tool - imgalt

Post by GreatAttractor » Sun Apr 27, 2014 8:38 am

Wah,
You're right, I think that if I tried to find the translation always with respect to the first frame, the shifts would be even worse - due to surface features changing. I will be testing some other ideas for better alignment though, perhaps a second pass with "block matching" or another phase correlation on a small, most contrasty fragment.

Houghy,
Only BMPs, I wanted to keep the file-operating part small and w/o dependence on ext. libraries. (I might add them some time later).

Neo,
But you'd still need to end up with 8-bit depth for final publication. Of course, you do all processing in 16-bit, but then you can just use imgalt as one of the final steps.
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

Wah
Im an EXPERT!
Im an EXPERT!
Posts: 338
Joined: Tue May 01, 2012 2:14 am

Re: Solar animation automatic alignment tool - imgalt

Post by Wah » Sun Apr 27, 2014 12:29 pm

Another thought, can there be a parameter that change reference frame after every k (eg. 10) frames being processed? Maybe larger the number, less the shift?

BTW, can the shift value be sub-pixel?

User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

Re: Solar animation automatic alignment tool - imgalt

Post by GreatAttractor » Sun Apr 27, 2014 2:33 pm

Wah,
I might try the parameter. As for detecting subpixel translation, I'm already working on it; at first to just refine the current 1-pixel translation, later I'd like to add a true subpixel translation (with neccessary interpolation) of output images.
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

Re: Solar animation automatic alignment tool - imgalt

Post by GreatAttractor » Fri May 02, 2014 9:14 pm

New version 0.4:

- cropping output images to their intersection, i.e. the largest common area (for padding to bounding box instead, use --no-crop parameter)
- fixed translation of output images, which caused chaotic 1-pixel jittering

Coming soon: reading and saving of 8- and 16-bit TIFFs (not compressed).
Coming not so soon: subpixel alignment and "stabilize using the limb" mode for prominence and limb sunspot animations.

Download from http://stargazerslounge.com/blog/1400/e ... 54-imgalt/
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

User avatar
swisswalter
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 17951
Joined: Thu Feb 06, 2014 4:28 am
Location: Switzerland
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by swisswalter » Sat May 03, 2014 5:45 am

Hi Filip

thank for running a head. Soon I'll have to jump in too ;)
Only stardust in the wind, some fine and some less fine scopes, filters and adapters as well. Switzerland 47 N, 9 E, in the heart of EUROPE :)

from 7 am - 7 pm http://www.nanosys.ch

from 7.01 pm - 6.59 am http://www.wastronomiko.com some times vice versa ;)

edobosz
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 2767
Joined: Sun Feb 12, 2012 6:45 pm
Location: Sydney Australia

Re: Solar animation automatic alignment tool - imgalt

Post by edobosz » Sat May 03, 2014 6:50 am

Good job! This looks like a very useful tool.
Ted
Lunt LS80THa DSII Quark Prominence ES127mm refractor

User avatar
marktownley
Librarian
Librarian
Posts: 23913
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by marktownley » Sat May 03, 2014 6:52 am

I can see i'm going to have to give this a try at some point ;)
Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!

User avatar
Montana
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 19294
Joined: Mon Oct 17, 2011 5:25 pm
Location: Cheshire, UK

Re: Solar animation automatic alignment tool - imgalt

Post by Montana » Sun May 04, 2014 2:46 pm

Excellent :bow :bow :bow

Alexandra

User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

Re: Solar animation automatic alignment tool - imgalt

Post by GreatAttractor » Mon May 05, 2014 9:32 pm

I had some TIFF code lying around, so here it comes...

New version 0.4.1:
- support for TIFF files (8 and 16 bits per channel, mono or RGB, not compressed)

Download from http://stargazerslounge.com/blog/1400/e ... 54-imgalt/


Mark, perhaps this thread could be now moved to the Solar Reference Library section?
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

User avatar
marktownley
Librarian
Librarian
Posts: 23913
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by marktownley » Mon May 05, 2014 10:06 pm

Sure, no problem :)
Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!

User avatar
GreatAttractor
Almost There...
Almost There...
Posts: 579
Joined: Sat Jun 01, 2013 1:04 pm
Location: Poland

imgalt - version 0.5

Post by GreatAttractor » Thu May 22, 2014 6:28 pm

New version 0.5 of imgalt can be downloaded from http://stargazerslounge.com/blog/1400/e ... 54-imgalt/. New feature: sub-pixel alignment. Processing time is unaffected (sub-pixel translation is deduced from the data that was already calculated), though saving of output images takes a bit longer.

The difference in alignment is not huge; the output is still fluid frame-to-frame, however the long-term "drift" of the image is somewhat reduced.
Also, the interpolation required for sub-pixel translation results in some slight blurring of output images (only if you have sharp, 1-pixel details), though in most cases this shouldn't be an issue. Example:
example.gif
example.gif (326.44 KiB) Viewed 4834 times
Sub-pixel alignment can be disabled by using --no-subpixel parameter.



Mark, could you add this post to the main imgalt thread: http://solarchat.natca.net/viewtopic.php?f=7&t=11283

Also, is it possible to give users permission to reply there? I intended that thread to be also a place for any features/issues discussion.
My software:
Stackistry — an open-source cross-platform image stacker
ImPPG — stack post-processing and animation alignment
My images

SW Mak-Cass 127, ATM Hα scope (D=90 mm, LS50 etalon), Lunt LS50THa, ATM SSM, ATM Newt 300/1500 mm, PGR Chameleon 3 mono (ICX445)

User avatar
marktownley
Librarian
Librarian
Posts: 23913
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Contact:

Re: Solar animation automatic alignment tool - imgalt

Post by marktownley » Thu May 22, 2014 6:50 pm

Thanks for the update, and thanks for sharing on solarchat!

Merged as requested, as far as I can see replies are active - well I can - can other people?
Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests