I got four 120 seconds ISO 800 RAW frames. Better option would be to go for 60 seconds ISO 1600 and minimize tracking errors, stacking should eliminate noise anyway. Since pictures are taken under suburban sky, they are overexposed and have ugly orange background color. When we open them in Darktable default white balance preset is camera white balance and that looks like this.
Now we want to eliminate that ugly orange background and we switch from camera white balance to spot white balance.
If images were saved as JPEG, camera white balance would be applied, colors shifted to allow better compression and we won’t be able to do much processing. Before exporting images to TIFF, to export hit Ctrl+e, we will tweak exposure as on picture:
I export them as 16 bit integer per channel TIFF, if you do not know how to manage export settings it is explained in previous blog entries.
Now to do stacking I will open terminal and execute magic formula:
align_image_stack -a tif *.tiff
gmic tif0000.tif tif0001.tif -div 256 -gimp_blend 3,1,0 -mul 256 -c 0,65536 -type ushort -output one.tiff
gmic tif0002.tif tif0003.tif -div 256 -gimp_blend 3,1,0 -mul 256 -c 0,65536 -type ushort -output two.tiff
gmic one.tiff two.tiff -div 256 -gimp_blend 3,1,0 -mul 256 -c 0,65536 -type ushort -output tutorial.tiff
If you compare it with previous blog entries about G’MIC stacking you will see that new version of G’MIC is not completely backward compatible. Some people would maybe like to use DSS instead and that is also OK. Finally we open image in GIMP bump up contrast and LAB color decompose image. We duplicate A and B component, set copy mode to overlay and then merge them down. Do not flatten layers, there should be L, A and B layers. L layer can be slightly stretched or left how it is. When we LAB compose layers back into RGB image we will have nice saturated colors. Now, some people will proceed playing with curves but I will just add background gradient. I am not really using it as intended. I switch from divide to overlay and reduce opacity to 50%. That background gradient is part of astronomy plugin for GIMP by Georg Hennig and 2.8 compatible version is available from here git://gitorious.org/gimp-plugins-ambulance/gimp-plugin-astronomy.git. Building plugin is trivial. Here is result:
Complete damage control was done in Darktable in three straightforward steps and that is why I call it easy. If level of black was lower and and for example exposure was reduced only -0.5EV, we could further increase contrast and get more of that Flame nebula. Though it will be more fiddling in GIMP and may be not so simple as it sounds.
Showing posts with label GIMP. Show all posts
Showing posts with label GIMP. Show all posts
Sunday, March 24, 2013
Tuesday, February 19, 2013
Simple Moon processing workflow with Open Source tools
About 50 pictures are taken through small 4.5 inch Newtonian using T-adapter. Since back-focus on this small scope is too short, Barlow x2 is used, what rises focal ratio from f8 to f16. Out of those 50 there is one or two where turbulence is not bad. After transfer of images from camera to hard drive, Rawstudio is used to preview them and find better ones. For conversion from RAW to TIFF I am using Darktable. Here you can see what processing is done in Darktable, what modules are active:
Exported TIFF is then imported in GIMP and GMIC is activated from Filters menu. We will stay in GMIC until end with exception when we are copying layers. From Colors, Tone mapping is performed, using default parameters, and we will work further with result of that transformation.
While it looks better I am not happy with amount of detail, so from the same group with default parameters Local normalization is performed and output mode is set to new image.
Again starting from tone-mapped image, using default parameters Local contrast enhancement from Enhancement group is applied.
At this moment one can decide to use those three image to create pseudo HDR using exposure blend, but I didn’t like flat border area in output, caused by local contrast enhancement. Now I copy-paste local contrast enhanced over local contrast normalized and in GMIC, using input layers all, execute Average blending in Layers group, that is the first one with [standard]. Over result of averaging I copy-paste tone-mapped image, one we started with and do again averaging. This is final result:
Exported TIFF is then imported in GIMP and GMIC is activated from Filters menu. We will stay in GMIC until end with exception when we are copying layers. From Colors, Tone mapping is performed, using default parameters, and we will work further with result of that transformation.
While it looks better I am not happy with amount of detail, so from the same group with default parameters Local normalization is performed and output mode is set to new image.
Again starting from tone-mapped image, using default parameters Local contrast enhancement from Enhancement group is applied.
At this moment one can decide to use those three image to create pseudo HDR using exposure blend, but I didn’t like flat border area in output, caused by local contrast enhancement. Now I copy-paste local contrast enhanced over local contrast normalized and in GMIC, using input layers all, execute Average blending in Layers group, that is the first one with [standard]. Over result of averaging I copy-paste tone-mapped image, one we started with and do again averaging. This is final result:
Monday, January 21, 2013
Building GIMP 2.9.1 from source on Linux Mint 13
On Open Source Photography group on Google+ https://plus.google.com/u/0/communities/110647644928874455108 goes discussion: how nobody is providing deb for GIMP 2.9.1 and you can download installer for Mac or Windows, for example from here http://www.partha.com/. I guess most of Linux users are capable of compiling and building software on its own and that could be reason. There are distros like Gentoo Linux where building packages from source is common and in that way your binaries will be best match for your hardware. On the other side building GIMP is not so easy, for example one of dependencies is Gtk+ and that one is never easy to build. Since I am doing programming for living, I decided to help and write tutorial how to build GIMP 2.9.1 from source. Before I start, GIMP 2.9.1 is unstable development release, it is not intended for final user, it is slow and if you still want to build it do that in VM, place build environment in KVM or VBox. On positive side - yes it can handle 16 bit integer channel.
Starting point for me was Compiling Gimp 2.9.x on PCLinuxOS KDE4 2012.02 http://sparewotw.wordpress.com/2012/03/19/compiling-gimp-2-7-6-development-version-on-pclinuxos-kde4-2012-02/, thanks Andrzej. My desktop is Mate and his KDE but PCLinuxOS is based on Ubuntu like Mint, though packages are called slightly differently. If one is starting from plain new install he can start with:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
Next libs for processing image and media formats like libtiff, libjpeg, libavcodec-extra-53, libvpx and so on. Naturally you will need corresponding dev packages also, since you want to compile against them. From development you will need Flex, Bison, Lua, Yasm; Python and Ruby you should already have. To get source code you need Git, source is at git://git.gnome.org/gimp and it is not marked as 2.9 but as 2.8, so do not get confused, check configure.ac and look for:
m4_define([gimp_app_version], [2.9])
I will not try to exactly list dependencies, you will see what is missing from error message if ./configure fails. Also going through Andrzej’s recommended list, one can do:
apt-cache search [package name without version number]
and see what is it called on Mint or Ubuntu or Debian.
Now following Andrzej’s tutorial download recommended dependencies, extract them where you want to build them, I do that in ~install. Do not deviate in package version since interfaces are changing and you will not be able to build. Now is time to start build, open terminal and elevate it to root level, cd where you will start build and set $PREFIX, $PATH and $PKG_CONFIG_PATH:
export PREFIX=`echo /usr/`
export PATH=$PREFIX/bin:$PATH
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig
While this is OK on clean box, rather go for /usr/local value for $PREFIX if you not doing it in VM or you do not have spare box for build. I also did
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
First dependency is libffi-3.0.11 and as in Andrzej’s tutorial you just do, from the same terminal where those environment variables are exported:
./configure --prefix=$PREFIX
make
make install
This one should go without problems. You should see messages like this one:
Libraries have been installed in:
/usr/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
Next is glib-2.32.2 and quite few other packages are depending on it. When you finish building it do:
ldconfig
ldconfig -n /usr/lib
The first one clears library cache and the second one renews links in /usr/lib, that is where we are installing build output. To check situation do:
ldconfig -p | grep glib
ls -l /usr/lib | grep glib
The first prints links and the second one will say to what links are pointing, for example:
lrwxrwxrwx 1 root root 23 Jan 20 22:24 libglib-2.0.so -> libglib-2.0.so.0.3200.2
If there are links to something like libglib-2.0.so.0.3400.3 they must be removed, together with libs. Check situation for libgio-2.0, libglib-2.0, libgmodule-2.0, libgobject-2.0 and libgthread-2.0. You should not have them unless you downloaded and did build of different version of glib. Leave alone lower versions like libglib-1.2.so.0.0.10, which may be there, but higher ones you should remove and links pointing to them. Tricky to configure and build is gtk+-2.24.10, if you run into problems double check are you bilding against right dependencies, if not get right ones and
make clean
ldconfig
./configure --prefix=$PREFIX
Like that all ten downloaded dependencies are built and installed and we can clone from GIMP repository source and finish build:
git clone git://git.gnome.org/babl
git clone git://git.gnome.org/gegl
git clone git://git.gnome.org/gimp
git clone git://git.gnome.org/gimp-gap
I didn’t even try gimp-gap since Andrzej was complaining that he can’t build it and GIMP works without it. For top three in the same order, cd in their root directory and:
./autogen.sh --prefix=$PREFIX
make
make install
GEGL was complaining about my custom FFmpeg and few other libs so I temporarily renamed offending libs and installed missing libx264-120 and libx264-dev. For example this is error message when make fails:
/usr/local/lib/libavformat.a: could not read symbols: Bad value
When GIMP is built you can run it executing:
/usr/bin/gimp-2.9
I run it from terminal because it prints debug messages to terminal. Plugins for GIMP 2.8 will naturally work, so install gimp-plugin-registry. If you see messages like this one
Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine"
you will understand why is good idea to build it in VM. Enjoy.
Starting point for me was Compiling Gimp 2.9.x on PCLinuxOS KDE4 2012.02 http://sparewotw.wordpress.com/2012/03/19/compiling-gimp-2-7-6-development-version-on-pclinuxos-kde4-2012-02/, thanks Andrzej. My desktop is Mate and his KDE but PCLinuxOS is based on Ubuntu like Mint, though packages are called slightly differently. If one is starting from plain new install he can start with:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
Next libs for processing image and media formats like libtiff, libjpeg, libavcodec-extra-53, libvpx and so on. Naturally you will need corresponding dev packages also, since you want to compile against them. From development you will need Flex, Bison, Lua, Yasm; Python and Ruby you should already have. To get source code you need Git, source is at git://git.gnome.org/gimp and it is not marked as 2.9 but as 2.8, so do not get confused, check configure.ac and look for:
m4_define([gimp_app_version], [2.9])
I will not try to exactly list dependencies, you will see what is missing from error message if ./configure fails. Also going through Andrzej’s recommended list, one can do:
apt-cache search [package name without version number]
and see what is it called on Mint or Ubuntu or Debian.
Now following Andrzej’s tutorial download recommended dependencies, extract them where you want to build them, I do that in ~install. Do not deviate in package version since interfaces are changing and you will not be able to build. Now is time to start build, open terminal and elevate it to root level, cd where you will start build and set $PREFIX, $PATH and $PKG_CONFIG_PATH:
export PREFIX=`echo /usr/`
export PATH=$PREFIX/bin:$PATH
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig
While this is OK on clean box, rather go for /usr/local value for $PREFIX if you not doing it in VM or you do not have spare box for build. I also did
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
First dependency is libffi-3.0.11 and as in Andrzej’s tutorial you just do, from the same terminal where those environment variables are exported:
./configure --prefix=$PREFIX
make
make install
This one should go without problems. You should see messages like this one:
Libraries have been installed in:
/usr/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
Next is glib-2.32.2 and quite few other packages are depending on it. When you finish building it do:
ldconfig
ldconfig -n /usr/lib
The first one clears library cache and the second one renews links in /usr/lib, that is where we are installing build output. To check situation do:
ldconfig -p | grep glib
ls -l /usr/lib | grep glib
The first prints links and the second one will say to what links are pointing, for example:
lrwxrwxrwx 1 root root 23 Jan 20 22:24 libglib-2.0.so -> libglib-2.0.so.0.3200.2
If there are links to something like libglib-2.0.so.0.3400.3 they must be removed, together with libs. Check situation for libgio-2.0, libglib-2.0, libgmodule-2.0, libgobject-2.0 and libgthread-2.0. You should not have them unless you downloaded and did build of different version of glib. Leave alone lower versions like libglib-1.2.so.0.0.10, which may be there, but higher ones you should remove and links pointing to them. Tricky to configure and build is gtk+-2.24.10, if you run into problems double check are you bilding against right dependencies, if not get right ones and
make clean
ldconfig
./configure --prefix=$PREFIX
Like that all ten downloaded dependencies are built and installed and we can clone from GIMP repository source and finish build:
git clone git://git.gnome.org/babl
git clone git://git.gnome.org/gegl
git clone git://git.gnome.org/gimp
git clone git://git.gnome.org/gimp-gap
I didn’t even try gimp-gap since Andrzej was complaining that he can’t build it and GIMP works without it. For top three in the same order, cd in their root directory and:
./autogen.sh --prefix=$PREFIX
make
make install
GEGL was complaining about my custom FFmpeg and few other libs so I temporarily renamed offending libs and installed missing libx264-120 and libx264-dev. For example this is error message when make fails:
/usr/local/lib/libavformat.a: could not read symbols: Bad value
When GIMP is built you can run it executing:
/usr/bin/gimp-2.9
I run it from terminal because it prints debug messages to terminal. Plugins for GIMP 2.8 will naturally work, so install gimp-plugin-registry. If you see messages like this one
Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine"
you will understand why is good idea to build it in VM. Enjoy.
Friday, January 11, 2013
Orion’s belt and sword, processing with open source tools
Capturing photos
To do processing one needs to take few photos first. Minimal hardware is DSLR with 50mm lens, remote shutter release for DSLR and any kind of cheap telescope with equatorial mount. It is not necessary to buy 50mm lens, kit lens usually 18-55mm will do, if your DSLR have live view and you can set focus. Manually setting focus on kit lens without live view is quite difficult. But it will be nice to have one 50mm F1.8 lens which is much faster and sharper than kit lens. If you have longer focal length lens it is even better, 100mm or even up to 200mm, over it tracking becomes big problem. Why remote shutter release? Camera supports up to 30 seconds exposure and after that BULB, you should press and hold shutter button what will cause lot of shaking and ruin photo. For that reason remote shutter release is used, we can have long exposure without shaking and strain. Telescope is used so that we can piggyback camera on it and achieve long exposure without trailing stars. How to attach camera to scope, there are piggyback brackets, piggyback camera mounts, you can make them on your own using hose clamp. If your telescope got RA motor drive, do polar alignment and switch it on, shorter focal length of the lens is more tolerant towards tracking errors. If there is no RA motor drive you will have to do manual tracking. Telescope with alt-azimuth mount won’t do it must be with equatorial mount. There are specialized devices like Vixen Polarie or AstroTrac which can be used instead, but they are more expensive than small 5" Newtonians with RA motor drive. Why one shouldn’t just do few hundreds shots from tripod and later stack that in Deep Sky Stacker? Because 5 seconds would be longest acceptable exposure for 50mm lens and to get to 5 minutes you need 3600 photos. Way to go is increasing exposure time.If you are not sure where is Orion or M42 inside Orion install Stellarium http://www.stellarium.org/ it is open source and works on all major operating systems.
Processing
So I went out under my light polluted suburban sky and managed to get few decent photos between clouds. I did the same night before and now I have 13 frames 55mm F5.6 ISO 800 where exposure is from one minute to two minutes. When I decided to crop them and stack them together align_image_stack from Hugin did poor job. Was that too narrow cropping or something else I do not know, for that reason new strategy was stack them by night and later stack final results. So, imported RAWs into darktable, applied chromatic aberration and lens correction and exported them to 16 bit TIF. Should do hot pixels removal but I forgot to do it and did it later in G’MIC, like this:gmic IMG_0451.tiff -remove_hotpixels 3,10 -c 0,65536 -type ushort -output IMG_0451hp.tiff
Now I aligned stack:
align_image_stack -a tif *.tiff
and averaged them two by two, saving output:
gmic tif0000.tif tif0001.tif -div 256 -gimp_compose_average 1,0 -mul 256 -c 0,65536 -type ushort -output step1.tiff
Later I combined those steps, two by two, until final result. To stack those two images I need to rotate one and to crop both of them:
gmic m4291.tiff -rotate -66 -crop 1400,2500,3500,4700 -c 0,65536 -type ushort -output m4291c.tiff
gmic m4281.tiff -crop 1450,767,3550,2967 -c 0,65536 -type ushort -output m4281c.tiff
To find out how much to rotate and crop I used GIMP. Now fine alignment of those two with align_image_stack:
align_image_stack -a tif *.tiff
and final blending for16 bit output:
gmic tif0000.tif tif0001.tif -div 256 -gimp_compose_average 1,0 -mul 256 -c 0,65536 -type ushort -output m4289.tiff
and also one 8 bit for GIMP:
gmic tif0000.tif tif0001.tif -div 256 -gimp_compose_average 1,0 -output m4289.jpg
Light pollution and clouds contributed to final result.
It is too bright, too much orange in it, but M42 is visible and Flame nebula is just barely visible. If we look at histogram, this is where we are and where we want to be:
From GIMP menu we select Color->Levels. In Adjust Color Levels we set Channel to Red and move upper slide from the bottom towards middle.
We do the same for green, looking at histogram set to RGB and picture itself. After this image is still too bright and Flame nebula is invisible. To remedy that I will rise contrast, Colors->Brightness-Contrast and I set contrast on 40. Now LAB decompose color boost, described in one of previous tutorials and some more contrast stretching via Colors->Auto->White Balance and after that Edit->Fade, we want histogram stretched but not that much, again checking image and histogram to find out how much.
Here is the final result:
Conclusion I need lens and light pollution filter ;-)
Labels:
Astrophotography,
G'MIC,
GIMP,
image stacking,
open source,
Photography
Saturday, December 15, 2012
How to stack images using G’MIC
After chat on Astophotography Google+ community https://plus.google.com/u/0/communities/118208937662082340807 I concluded that it may be enough interest for 16 bit image processing using G’MIC tutorial and here it is.
G'MIC stands for GREYC's Magic Image Converter and we know it as plugin for GIMP. It is less known that G'MIC framework can be used on it’s own through simple shell scripting or possible C++ or web interface. What is very important it supports 16 bits integers per channel and that is something what GIMP is lacking.
So, what we are going to do here is to take a look at G’MIC tutorial http://gmic.sourceforge.net/tutorial.shtml and load images into stack average them and save them as 16 bit TIFF.
Tutorial says if you are using G’MIC as GIMP plugin and set logging to verbose it will print what it does.
I prefer writing output to log file to suggested running GIMP from terminal (command line for Windows users). Standard path and name for log file is /tmp/gmic_log
Also from tutorial we see that 16 bit processing starts with division with 256 and ends with multiplication with 256. While that represents reduction to 8 bit it is important to note that G’MIC internally works with floating point numbers and there is no loss of precision when we convert it back to 16 bit integers. Once when we are done with processing it is important how we are going to specify TIFF output. G’MIC will pick format from extension but it by default writes 32 bit TIFF. So, to get 8 bit TIFF we need to specify output type uchar and to get 16 bit TIFF we need to specify output type ushort.
Typical operations which we are going to use are:
Averaging layers will produce at the end two layers, if we want we can save them as separate pictures, like this:
$ gmic tif0000.tif tif0001.tif tif0002.tif tif0003.tif -div 256 -gimp_compose_average 1,0 -mul 256 -c 0,65536 -type ushort -output[1] imageA.tiff -output[0] imageB.tiff
or we can stack those two layers in screen mode to boost light and stretch contrast, like this:
$ gmic tif0000.tif tif0001.tif tif0002.tif tif0003.tif -div 256 -gimp_compose_average 1,0 -gimp_compose_screen 1,0 -mul 256 -c 0,65536 -type ushort -output imageS.tiff
If we want to do resizing we can as in G’MIC tutorial use -resize2dx 1600,5 what is bi-cubic resizing to 1600 pixels width.
Instead of averaging we can try other options like -compose_median what is median or any other available filter or combination of filters, we try in GIMP, set logging to verbose and later run it in terminal without loss of data.
G'MIC stands for GREYC's Magic Image Converter and we know it as plugin for GIMP. It is less known that G'MIC framework can be used on it’s own through simple shell scripting or possible C++ or web interface. What is very important it supports 16 bits integers per channel and that is something what GIMP is lacking.
So, what we are going to do here is to take a look at G’MIC tutorial http://gmic.sourceforge.net/tutorial.shtml and load images into stack average them and save them as 16 bit TIFF.
Tutorial says if you are using G’MIC as GIMP plugin and set logging to verbose it will print what it does.
I prefer writing output to log file to suggested running GIMP from terminal (command line for Windows users). Standard path and name for log file is /tmp/gmic_log
Also from tutorial we see that 16 bit processing starts with division with 256 and ends with multiplication with 256. While that represents reduction to 8 bit it is important to note that G’MIC internally works with floating point numbers and there is no loss of precision when we convert it back to 16 bit integers. Once when we are done with processing it is important how we are going to specify TIFF output. G’MIC will pick format from extension but it by default writes 32 bit TIFF. So, to get 8 bit TIFF we need to specify output type uchar and to get 16 bit TIFF we need to specify output type ushort.
Typical operations which we are going to use are:
- -gimp_haar_smoothing 0.1,10,2,0,0 what is Smooth [wavelets] under Enhancements
- -gimp_compose_average 1,0 what is Blend [average] under Layers
- -gimp_compose_screen 1,0 what is Blend [screen] under Layers
Averaging layers will produce at the end two layers, if we want we can save them as separate pictures, like this:
$ gmic tif0000.tif tif0001.tif tif0002.tif tif0003.tif -div 256 -gimp_compose_average 1,0 -mul 256 -c 0,65536 -type ushort -output[1] imageA.tiff -output[0] imageB.tiff
or we can stack those two layers in screen mode to boost light and stretch contrast, like this:
$ gmic tif0000.tif tif0001.tif tif0002.tif tif0003.tif -div 256 -gimp_compose_average 1,0 -gimp_compose_screen 1,0 -mul 256 -c 0,65536 -type ushort -output imageS.tiff
If we want to do resizing we can as in G’MIC tutorial use -resize2dx 1600,5 what is bi-cubic resizing to 1600 pixels width.
Instead of averaging we can try other options like -compose_median what is median or any other available filter or combination of filters, we try in GIMP, set logging to verbose and later run it in terminal without loss of data.
Labels:
Astrophotography,
G'MIC,
GIMP,
image stacking,
stack alignment
Monday, December 10, 2012
How to align image stack
Aligning images in GIMP is not very difficult if we do not have rotation to attend to, if rotation is present we rather leave that task to computer.
Aligning stack of images is not only used in astrophotography, it is common task in creation of HDR images. So, we can use align_image_stack from hugin-tools to align images. Installation procedure on Mint or Ubuntu is simple, we find it:
$ apt-cache search hugin
enblend - image blending tool
enfuse - image exposure blending tool
hugin - panorama photo stitcher - GUI tools
hugin-data - panorama photo stitcher - common data files
hugin-tools - panorama photo stitcher - commandline tools
and after that we install it:
$ sudo apt-get install hugin
It is available from repositories and there is no need to compile it from source. People using different operating system from Linux should visit Hugin website http://hugin.sourceforge.net/download/ and download installer for their operating system.
Once Hugin is installed align_image_stack should be available and we can align image stack. If you do not have own images in this tutorial http://grumpyoldprogrammer.blogspot.com/2012/11/even-more-astrophotography.html you will find download links.
We place in some empty directory JPEGs, if you have RAWs convert them, cd to that directory and execute:
$ align_image_stack -a tif *.JPG
Option -a tif means we want tif indexed output, so after a while we will see tif0000.tif, tif0001.tif and so on. Parameter *.JPG is input list, align all JPEGs. Alternatively we can specify file by file. Once alignment is done we can start GIMP and open all images as layers.
In order to check alignment we can change mode for top layer from Normal to Difference in Layers - Brushes floating window. To check further we make top layer invisible and repeat the same procedure for next layer.
Once we are happy we can stack images as described in previous tutorials or we can use GMI’C plugin. GMI’C is located under Filters and it opens as separate window. We expand Layers, select Average and set Input layers to All and Output mode to New image.
Clicking Apply or OK button will create new image. If you have new version of GIMP Median is also interesting. Average produces two layers and Median only one, we can stack them again. For final processing you may like to do some contrast stretching, maybe some curves as well.
Aligning stack of images is not only used in astrophotography, it is common task in creation of HDR images. So, we can use align_image_stack from hugin-tools to align images. Installation procedure on Mint or Ubuntu is simple, we find it:
$ apt-cache search hugin
enblend - image blending tool
enfuse - image exposure blending tool
hugin - panorama photo stitcher - GUI tools
hugin-data - panorama photo stitcher - common data files
hugin-tools - panorama photo stitcher - commandline tools
and after that we install it:
$ sudo apt-get install hugin
It is available from repositories and there is no need to compile it from source. People using different operating system from Linux should visit Hugin website http://hugin.sourceforge.net/download/ and download installer for their operating system.
Once Hugin is installed align_image_stack should be available and we can align image stack. If you do not have own images in this tutorial http://grumpyoldprogrammer.blogspot.com/2012/11/even-more-astrophotography.html you will find download links.
We place in some empty directory JPEGs, if you have RAWs convert them, cd to that directory and execute:
$ align_image_stack -a tif *.JPG
Option -a tif means we want tif indexed output, so after a while we will see tif0000.tif, tif0001.tif and so on. Parameter *.JPG is input list, align all JPEGs. Alternatively we can specify file by file. Once alignment is done we can start GIMP and open all images as layers.
In order to check alignment we can change mode for top layer from Normal to Difference in Layers - Brushes floating window. To check further we make top layer invisible and repeat the same procedure for next layer.
Once we are happy we can stack images as described in previous tutorials or we can use GMI’C plugin. GMI’C is located under Filters and it opens as separate window. We expand Layers, select Average and set Input layers to All and Output mode to New image.
Clicking Apply or OK button will create new image. If you have new version of GIMP Median is also interesting. Average produces two layers and Median only one, we can stack them again. For final processing you may like to do some contrast stretching, maybe some curves as well.
Labels:
Astrophotography,
GIMP,
Hugin,
image stacking,
Linux,
stack alignment
Friday, November 23, 2012
More about stacking
In the last tutorial we stacked few frames using GIMP after manually aligning them. Since we were setting layers to screen mode it was at the end quite bright. What we could do to make it more natural is to make additional layers transparent. Opacity of bottom layer 100%, next 50%, next 25% and so on.
Here Windows users have really wide choice of free or paid programs. For example Deep Sky Stacker and RegiStax. If there is dozen or more frames to stack it pays to start KVM or VBox and struggle with Windows for for few minutes in order to use Deep Sky Stacker. There is no real equivalent which will do the same task on Linux, register, align and stack frames using GUI. For smaller number of frames we can use ale - The Anti-Lamenessing Engine written by David Hilvert. Typically it is not compiled with ImageMagick support enabled, so we have to prepare images to be processed an to convert them into ppm format. We can install ImageMagick and use mogrify and convert to convert photos from terminal, but in order to make things easier we will use GUI.
If we are using DSLR camera or some of those new compact cameras we may be able store images in RAW format. It allows us to do significant amount of processing on such image. There is few really good programs for RAW processing, like UFRaw, RawTherapee or Darktable. We are going to use the last one Darktable. After installation we will right click on RAW file and select from context menu Open With Darktable. User interface is non-conventional so here is quick explanation. We want our RAW to be converted to ppm and we want to remove hot pixels.
Proper removal of hot pixels would be taking “dark frames” at the end of the session. That is place cap on lens and take picture using the same ISO value and exposure time as data frames. After that we can add dark to data frame as layer in GIMP and subtract it to remove hot pixels.
When Darktable shows-up we will see in the right pane tab which says more plugins. Clicking on it we open it and select hot pixels plugin. Again clicking on it we close it and under correct tab is hot pixels plugin, which is "switched off". We "switch it on" and it removes hot pixels.
We are happy with all default processing so far. Now we want to export image to ppm. For that we hit key “l” what brigs us to lighttable mode. On the right pane we locate export selected and make it to look like this:
Export could be achieved via export button or keyboard shortcut Ctrl+e. To go back to darkroom mode we hit “d”. We repeat process on all frames. If we added some exposure, EV or maybe two, it is likely that we have generated noise. Also if we do not want full size picture we may want to resize it, ale will finish processing much faster. In GIMP we do Filters -> Enhance ->Wavelet Denoise and here is how it looks after and before denoising:
If we want to resize that is Image -> Scale image, and we export image back to original ppm.
Now we can open terminal and cd to folder with ppms. This is what I did and what was output in terminal
Here is explanation --md Set element minimum dimension x. (100 is default), --dchain fine:box:1 approximates drizzling. and two remaining params are input and output. To get more info execute ale --hA.
Result was rather cold and dark. In order to bring some warmth and dynamics I opened stacked.ppm in GIMP and did Colors -> Components -> Decompose where from drop-down LAB is desired. Now for each layer I made only one which I am currently working on visible and others invisible, clicking on eye in layers docking window. Then after duplicating layer and setting copy layer to Overlay mode, I merged visible layers accepting default option expand as necessary. That was repeated for L, A and B layer.
After that Colors -> Components -> Compose, again selecting LAB. At the end Colors -> Auto -> White Balance and Edit -> Fade Levels with default Replace mode and Opacity 33. Here is result:
Those are the same four frames from last tutorial, if you do not have own to process, download them, convert them to ppm and you can try ale stacking and post-processing with them.
Automated stacking
Here Windows users have really wide choice of free or paid programs. For example Deep Sky Stacker and RegiStax. If there is dozen or more frames to stack it pays to start KVM or VBox and struggle with Windows for for few minutes in order to use Deep Sky Stacker. There is no real equivalent which will do the same task on Linux, register, align and stack frames using GUI. For smaller number of frames we can use ale - The Anti-Lamenessing Engine written by David Hilvert. Typically it is not compiled with ImageMagick support enabled, so we have to prepare images to be processed an to convert them into ppm format. We can install ImageMagick and use mogrify and convert to convert photos from terminal, but in order to make things easier we will use GUI.
If we are using DSLR camera or some of those new compact cameras we may be able store images in RAW format. It allows us to do significant amount of processing on such image. There is few really good programs for RAW processing, like UFRaw, RawTherapee or Darktable. We are going to use the last one Darktable. After installation we will right click on RAW file and select from context menu Open With Darktable. User interface is non-conventional so here is quick explanation. We want our RAW to be converted to ppm and we want to remove hot pixels.
Proper removal of hot pixels would be taking “dark frames” at the end of the session. That is place cap on lens and take picture using the same ISO value and exposure time as data frames. After that we can add dark to data frame as layer in GIMP and subtract it to remove hot pixels.
When Darktable shows-up we will see in the right pane tab which says more plugins. Clicking on it we open it and select hot pixels plugin. Again clicking on it we close it and under correct tab is hot pixels plugin, which is "switched off". We "switch it on" and it removes hot pixels.
We are happy with all default processing so far. Now we want to export image to ppm. For that we hit key “l” what brigs us to lighttable mode. On the right pane we locate export selected and make it to look like this:
Export could be achieved via export button or keyboard shortcut Ctrl+e. To go back to darkroom mode we hit “d”. We repeat process on all frames. If we added some exposure, EV or maybe two, it is likely that we have generated noise. Also if we do not want full size picture we may want to resize it, ale will finish processing much faster. In GIMP we do Filters -> Enhance ->Wavelet Denoise and here is how it looks after and before denoising:
If we want to resize that is Image -> Scale image, and we export image back to original ppm.
Now we can open terminal and cd to folder with ppms. This is what I did and what was output in terminal
ale --md 64 --dchain fine:box:1 *.ppm stacked.ppm
Output file will be'stacked.ppm'.
Original Frame: 'img_0001_01.ppm'.
Supplemental Frames:
'img_0001_02.ppm'***** okay (88.869874% match).
'img_0001_03.ppm'***** okay (90.897255% match).
'img_0001.ppm'***** okay (91.984785% match).
Iterating Irani-Peleg.
Average match: 90.583972%
Here is explanation --md
Result was rather cold and dark. In order to bring some warmth and dynamics I opened stacked.ppm in GIMP and did Colors -> Components -> Decompose where from drop-down LAB is desired. Now for each layer I made only one which I am currently working on visible and others invisible, clicking on eye in layers docking window. Then after duplicating layer and setting copy layer to Overlay mode, I merged visible layers accepting default option expand as necessary. That was repeated for L, A and B layer.
After that Colors -> Components -> Compose, again selecting LAB. At the end Colors -> Auto -> White Balance and Edit -> Fade Levels with default Replace mode and Opacity 33. Here is result:
Those are the same four frames from last tutorial, if you do not have own to process, download them, convert them to ppm and you can try ale stacking and post-processing with them.
Labels:
ale,
Astronomy,
Astrophotography,
Darktable,
GIMP,
image stacking,
Linux,
Photography
Wednesday, November 21, 2012
Even More Astrophotography
Everything what was described in previous tutorial should work on Windows as well. Fiji uses Java and works everywhere as advertised and GIMP installer for Windows certainly exists. How to install plugin registry on Windows I really do not know, Google is your friend.
We can go downloading and processing FITS files from many places beside mentioned LCOGT we can use Hubble data from http://hla.stsci.edu/hlaview.html or maybe data from Misti Mountain Observatory http://www.mistisoftware.com/astronomy/index_fits.htm to name few.
All that is nice, but real fun begins when we capture own data using our own camera.
Any kind of camera, any kind of lens, capable of delivering sharp pictures will do. There is another inexpensive piece of equipment which is a must - tripod. I am using old Sony A290 DSLR with SAL75300 telephoto lens.
Now we go out place tripod and put camera on it. Select manual mode, adjust ISO to 800, maybe 1600 and exposure long as possible bat not too long to avoid star trailing. Shorter focal length will allow longer exposures. How long exposure can be? That depends on many things, your position on the globe, declination of target and so on. With 75mm focal length on DSLR what corresponds to 112.5mm on 35mm SLR I am happy with 4 to 5 seconds of exposure in Johannesburg, South Africa. If 50mm lens is available I would go for 6 to 8 seconds exposure. So, select exposure, go into drive mode select three or five shots burst, aim and fire.
If you are going to use some stacking software like Deep Sky Stacker you can take RAW and JPEG picture simultaneously. Deep Sky Stacker will not work on Linux and you will have to run Windows inside virtual machine to use it.
When you have few nice snapshots of for example Milky Way you can go back to computer and stack them using GIMP. We will describe stacking in the last part of article.
Soon as you stack few snapshots appetite will start growing. Going for hundred snapshots is not way forward. Way forward is to increase exposure time. If you do not have $$$$ to spend on real telescope with computerised equatorial mount, you need to look for cost-effective solution. For example to build barn door tracker or you may just have cheap telescope with equatorial mount which is only good for taking Moon snapshots. Cheap telescopes are coming with poor quality equatorial mounts which are very shaky. Now worst thing which you may attempt is spending money to stabilise cheap mount. Attach weight to its tripod, few rounds of rope around legs to tighten it and that’s it. Doesn’t look nice but does job.
Placing camera on telescope could be done using proper piggyback mount or you can made one. I am using ordinary wire ties tightened between camera and quick release head. Don’t go too sloppy you may destroy camera in that way.
Placing eyepiece with higher magnification in and locating bright star close to edge of viewing field you are ready to go. My camera goes up to 30 seconds and after that BULB, for BULB I need remote, so 30 seconds is what I am aiming for. How long exposure can be? It depends of equatorial mount setup, with quick alignment you should be able to pool one minute. Tolerance for your tracking errors is again function of focal length, 300mm is likely just waste of time with maybe one good frame out dozen.
I uploaded four re-sized frames of area around M 8 if you want to practice before you take own snapshots. Here are links:
https://docs.google.com/open?id=0B0cIChfVrJ7WbkJtZjg3LWlGbXM
https://docs.google.com/open?id=0B0cIChfVrJ7WSWF1LUZ5UnBVRTg
https://docs.google.com/open?id=0B0cIChfVrJ7WMzdnRXdmZmJOSDQ
https://docs.google.com/open?id=0B0cIChfVrJ7WNFplbk5kb2ozYUU
We open the first frame and possibly reduce noise, if required, as in previous tutorial.
If you are using my frames, which are re-sized, there is no need for noise reduction or hot pixels removal. Hot pixels removal will remove quite few stars on re-sized image.
Since those are longer exposure captures we will have hot pixels. To eliminate hot pixels we open Filters -> G’MIC -> Enhancement -> Hot pixels filtering and apply it with default values. Now we open as layer next frame, select it in layers and in Filters we Repeat “G’MIC”. Now we set mode from Normal to Screen, zoom to 100% or more and align layers. We repeat the same for remaining frames. At the end we Merge Visible Layers from context menu for layers (right click one) accepting default expand as necessary option. If picture is too bright what would be a case with supplied pictures, we will do contrast stretching. As we add frames we increase level of signal and histogram changes like this:
So, Colors -> Auto -> White Balance and after that Edit -> Fade Levels where we set mode to Multiply. This is what final result should look like:
That would be simple manual stacking of JPEG frames with satisfactory final result. We could also align color levels on this picture but that was not goal of this tutorial.
We can go downloading and processing FITS files from many places beside mentioned LCOGT we can use Hubble data from http://hla.stsci.edu/hlaview.html or maybe data from Misti Mountain Observatory http://www.mistisoftware.com/astronomy/index_fits.htm to name few.
All that is nice, but real fun begins when we capture own data using our own camera.
Taking pictures without tracking
Any kind of camera, any kind of lens, capable of delivering sharp pictures will do. There is another inexpensive piece of equipment which is a must - tripod. I am using old Sony A290 DSLR with SAL75300 telephoto lens.
Now we go out place tripod and put camera on it. Select manual mode, adjust ISO to 800, maybe 1600 and exposure long as possible bat not too long to avoid star trailing. Shorter focal length will allow longer exposures. How long exposure can be? That depends on many things, your position on the globe, declination of target and so on. With 75mm focal length on DSLR what corresponds to 112.5mm on 35mm SLR I am happy with 4 to 5 seconds of exposure in Johannesburg, South Africa. If 50mm lens is available I would go for 6 to 8 seconds exposure. So, select exposure, go into drive mode select three or five shots burst, aim and fire.
If you are going to use some stacking software like Deep Sky Stacker you can take RAW and JPEG picture simultaneously. Deep Sky Stacker will not work on Linux and you will have to run Windows inside virtual machine to use it.
When you have few nice snapshots of for example Milky Way you can go back to computer and stack them using GIMP. We will describe stacking in the last part of article.
Manual tracking
Soon as you stack few snapshots appetite will start growing. Going for hundred snapshots is not way forward. Way forward is to increase exposure time. If you do not have $$$$ to spend on real telescope with computerised equatorial mount, you need to look for cost-effective solution. For example to build barn door tracker or you may just have cheap telescope with equatorial mount which is only good for taking Moon snapshots. Cheap telescopes are coming with poor quality equatorial mounts which are very shaky. Now worst thing which you may attempt is spending money to stabilise cheap mount. Attach weight to its tripod, few rounds of rope around legs to tighten it and that’s it. Doesn’t look nice but does job.
Placing camera on telescope could be done using proper piggyback mount or you can made one. I am using ordinary wire ties tightened between camera and quick release head. Don’t go too sloppy you may destroy camera in that way.
Placing eyepiece with higher magnification in and locating bright star close to edge of viewing field you are ready to go. My camera goes up to 30 seconds and after that BULB, for BULB I need remote, so 30 seconds is what I am aiming for. How long exposure can be? It depends of equatorial mount setup, with quick alignment you should be able to pool one minute. Tolerance for your tracking errors is again function of focal length, 300mm is likely just waste of time with maybe one good frame out dozen.
Stacking frames in GIMP
I uploaded four re-sized frames of area around M 8 if you want to practice before you take own snapshots. Here are links:
https://docs.google.com/open?id=0B0cIChfVrJ7WbkJtZjg3LWlGbXM
https://docs.google.com/open?id=0B0cIChfVrJ7WSWF1LUZ5UnBVRTg
https://docs.google.com/open?id=0B0cIChfVrJ7WMzdnRXdmZmJOSDQ
https://docs.google.com/open?id=0B0cIChfVrJ7WNFplbk5kb2ozYUU
We open the first frame and possibly reduce noise, if required, as in previous tutorial.
If you are using my frames, which are re-sized, there is no need for noise reduction or hot pixels removal. Hot pixels removal will remove quite few stars on re-sized image.
Since those are longer exposure captures we will have hot pixels. To eliminate hot pixels we open Filters -> G’MIC -> Enhancement -> Hot pixels filtering and apply it with default values. Now we open as layer next frame, select it in layers and in Filters we Repeat “G’MIC”. Now we set mode from Normal to Screen, zoom to 100% or more and align layers. We repeat the same for remaining frames. At the end we Merge Visible Layers from context menu for layers (right click one) accepting default expand as necessary option. If picture is too bright what would be a case with supplied pictures, we will do contrast stretching. As we add frames we increase level of signal and histogram changes like this:
So, Colors -> Auto -> White Balance and after that Edit -> Fade Levels where we set mode to Multiply. This is what final result should look like:
That would be simple manual stacking of JPEG frames with satisfactory final result. We could also align color levels on this picture but that was not goal of this tutorial.
Labels:
Astronomy,
Astrophotography,
GIMP,
image stacking,
Photography
Sunday, November 18, 2012
GIMP, Fiji and astrophotography on Linux
Ever wanted to know how to process
those wonderful Hubble like pictures on Linux? It is not difficult, I
will show you how. We will do RGB processing and LRGB is very
similar.
On the Web we will
encounter plenty tutorials where author uses some proprietary tool to
do contrast stretching and after that Photo Shop to do final
processing. Usually none of those will be available on Linux.
Replacement for Photo
Shop is no brainer, it is naturally popular GIMP. Tool for contrast
stretching is trickier. For nonlinear stretching I am using Fiji,
what is almost the same as ImageJ. Guess there is no distribution
which doesn’t offer GIMP so just follow usual install path for your
distro. It is good idea to install gimp-plugin-registry as well. For
Fiji you will have to download it from
http://fiji.sc/wiki/index.php/Downloads
and untar it. It comes with or without Java runtime, so we pick what
we need depending do we already have Java or not.
Now we installed required
programs and we need data. Typically data consists of three or more
gray images in FITS format. FITS is abbreviation for Flexible Image
Transport System. Good source of FITS data is Las Cumbres Observatory
Global Telescope Network and here is their website http://lcogt.net/
They have two two meter
reflectors and few smaller telescopes and observation data is freely
available under Creative Commons license. If you get data from 2m
telescope you will end-up with three 2008x2008 pixels images about
eight megabytes each. So go there and pick some galaxy from
Observations section, I will go for NGC6946, looks nice. After
downloading Blue, Green and Red FITS we can start.
And we immediately see why
we need contrast stretching, there is barely few stars. Now from menu
we do Process -> Enhance Contrast, tick equalize histogram and hit
OK button. Result looks like this:
There is much more to see but also
huge amount of noise. We repeat the same story for remaining files
and save them as Tiff. If we want we can go to Image -> Color ->
Merge Channels and create composite to see how approximately it will
look like.
It is nice but too much noise, time
for GIMP.
We open all three tifs in GIMP and we
do Filters -> Enhance ->Wavelet Denoise with settings like on
picture. If you don't have gimp-plugin-registry installed there will be no Wavelet Denoise then just do Despeckle few times.
We do the same on remaining two
pictures doing Ctrl+F repeating last filter. Next step is Image ->
Mode -> RGB followed by Colors -> Colorify and we apply what is
actual color on it.
Now we copy green and paste as layer
over red, rename Pasted Layer to something and change layer mode to
Screen, we do the same with blue one.
If alignment is OK we can merge
layers.
Now we can play with curves, levels
or do decomposition to enhance colors and so on, get imaginative
here. Here is how it looks like without any additional processing.
If frames are properly aligned we
could place them as layers into single image and do Colors ->
Components -> Compose what is simpler than doing Mode and
Colorify.
If we have LRGB, then we process RGB
as above. L we stretch, denoise and at the end use it as value layer
and RGB as color layer.
Labels:
Astronomy,
Astrophotography,
Fiji,
FITS processing,
GIMP,
Linux,
Photography,
RGB
Subscribe to:
Posts (Atom)