Solar animation automatic alignment tool - imgalt
Moderator: marktownley
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
Solar animation automatic alignment tool - imgalt
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: after: before (animation by warpal http://astropolis.pl/topic/39586-slonce ... ntry533305): after:
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.
I've created a tool implementing this approach, and so far results are satisfying, both for white light and H-alpha.
before: after: before (animation by warpal http://astropolis.pl/topic/39586-slonce ... ntry533305): after:
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.
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
Re: Solar animation automatic alignment tool - imgalt
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...).
- 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...).
- marktownley
- Librarian
- Posts: 42550
- Joined: Tue Oct 18, 2011 5:27 pm
- Location: Brierley Hills, UK
- Has thanked: 20819 times
- Been thanked: 10489 times
- Contact:
Re: Solar animation automatic alignment tool - imgalt
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...
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...
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!
-
- Im an EXPERT!
- Posts: 373
- Joined: Tue May 01, 2012 2:14 am
- Has thanked: 8 times
- Been thanked: 17 times
Re: Solar animation automatic alignment tool - imgalt
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!
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!
- robert
- Way More Fun to Share It!!
- Posts: 3070
- Joined: Fri Oct 14, 2011 1:49 pm
- Location: N.W.Scotland
- Has thanked: 4 times
- Been thanked: 1275 times
- Contact:
Re: Solar animation automatic alignment tool - imgalt
Many thanks for sharing, it looks very interesting
Robert
Robert
images and animations http://tinyurl.com/h5bgoso
2024 images https://www.flickr.com/photos/69734017@ ... 0313830045
2023 images https://www.flickr.com/photos/69734017@ ... 0304905278
ED80. ED100. Celestron-150mm-PST mod. C8 edge. ES127
LS60PT-LS60F-B1200. B600-Cak. PGR-Ch3-IMX265
2024 images https://www.flickr.com/photos/69734017@ ... 0313830045
2023 images https://www.flickr.com/photos/69734017@ ... 0304905278
ED80. ED100. Celestron-150mm-PST mod. C8 edge. ES127
LS60PT-LS60F-B1200. B600-Cak. PGR-Ch3-IMX265
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
Re: Solar animation automatic alignment tool - imgalt
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).
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).
- swisswalter
- Way More Fun to Share It!!
- Posts: 17948
- Joined: Thu Feb 06, 2014 4:28 am
- Location: Switzerland
- Been thanked: 1 time
- Contact:
Re: Solar animation automatic alignment tool - imgalt
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
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
from 7 am - 7 pm http://www.nanosys.ch
from 7.01 pm - 6.59 am http://www.wastronomiko.com some times vice versa
-
- Im an EXPERT!
- Posts: 373
- Joined: Tue May 01, 2012 2:14 am
- Has thanked: 8 times
- Been thanked: 17 times
Re: Solar animation automatic alignment tool - imgalt
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
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
Re: Solar animation automatic alignment tool - imgalt
do they have to be BMP files - can the software handle Tiffs and jpegs?
Just Learning
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
Re: Solar animation automatic alignment tool - imgalt
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.
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.
-
- Im an EXPERT!
- Posts: 373
- Joined: Tue May 01, 2012 2:14 am
- Has thanked: 8 times
- Been thanked: 17 times
Re: Solar animation automatic alignment tool - imgalt
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?
BTW, can the shift value be sub-pixel?
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
Re: Solar animation automatic alignment tool - imgalt
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.
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.
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
Re: Solar animation automatic alignment tool - imgalt
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/
- 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/
- swisswalter
- Way More Fun to Share It!!
- Posts: 17948
- Joined: Thu Feb 06, 2014 4:28 am
- Location: Switzerland
- Been thanked: 1 time
- Contact:
Re: Solar animation automatic alignment tool - imgalt
Hi Filip
thank for running a head. Soon I'll have to jump in too
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
from 7 am - 7 pm http://www.nanosys.ch
from 7.01 pm - 6.59 am http://www.wastronomiko.com some times vice versa
-
- 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
Good job! This looks like a very useful tool.
Ted
Ted
Lunt LS80THa DSII Quark Prominence ES127mm refractor
- marktownley
- Librarian
- Posts: 42550
- Joined: Tue Oct 18, 2011 5:27 pm
- Location: Brierley Hills, UK
- Has thanked: 20819 times
- Been thanked: 10489 times
- Contact:
Re: Solar animation automatic alignment tool - imgalt
I can see i'm going to have to give this a try at some point
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!
- Montana
- Librarian
- Posts: 34722
- Joined: Mon Oct 17, 2011 5:25 pm
- Location: Cheshire, UK
- Has thanked: 17974 times
- Been thanked: 8906 times
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
Re: Solar animation automatic alignment tool - imgalt
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?
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?
- marktownley
- Librarian
- Posts: 42550
- Joined: Tue Oct 18, 2011 5:27 pm
- Location: Brierley Hills, UK
- Has thanked: 20819 times
- Been thanked: 10489 times
- Contact:
Re: Solar animation automatic alignment tool - imgalt
Sure, no problem
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!
- GreatAttractor
- Almost There...
- Posts: 965
- Joined: Sat Jun 01, 2013 1:04 pm
- Location: Switzerland
- Has thanked: 747 times
- Been thanked: 757 times
imgalt - version 0.5
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:
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.
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:
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.
- marktownley
- Librarian
- Posts: 42550
- Joined: Tue Oct 18, 2011 5:27 pm
- Location: Brierley Hills, UK
- Has thanked: 20819 times
- Been thanked: 10489 times
- Contact:
Re: Solar animation automatic alignment tool - imgalt
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?
Merged as requested, as far as I can see replies are active - well I can - can other people?
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!