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.
Monday, January 21, 2013
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
Sunday, January 6, 2013
EasyCAP story
On Astrophotography group on Google + https://plus.google.com/u/0/communities/118208937662082340807 one beginner wanted advice what camera he can attach to his Powerseeker 127EQ and to pay it not more than $250. Astrophotography is known as money hole and it is difficult to imagine decent setup below $2000, and that is using entry level DSLR and not specialized CCD camera. Now I remembered that maybe year ago I was looking Deva camera by Astrolocker, GSTAR-EX http://www.myastroshop.com.au/guides/gstar/index.htm and JWT Messier http://www.jtwastronomy.com/products/messier.php.
Today cheapest Deva, it used to be $275, is gone from the market and others are significantly more expensive. So I advised using Samsung Ultra High Resolution SCB-2000 or similar CCTV camera with sense-up and EasyCAP DC 60 for video capture. What is idea, with sense-up activated up to x512, camera will internally stack up to 512 frames and capture will not take more than few seconds. About any equatorial mount with motor drive must be able to pull few seconds of decent tracking without significant errors. Naturally those cameras are not mach for DSLR camera. They are able to produce 752 × 582 on PAL and with sense-up activated noise ratio is not nominal 50dB. So how pictures actually look like? For example South African amateur astronomer Lucas Ferreira did quite few captures with Samsung SCB-4000 through 10" Newtonian Reflector and his pictures are here http://www.lucastronomy.co.za/Gallery/categories.php?cat_id=17. Looking at picture description we see that complete capture takes about 12 seconds with sense-up x512. While quality is very far from Hubble to get any kind of picture in 12 seconds with any normal camera one needs about two meters of aperture. So, I guess you agree with me CCTV camera can pull maximum out of small 5" Newtonian and even utilize his for proper astrophotography wobbly motor drive.
After giving advice I decided to put together CCTV camera and capture device and plug all that into PC. It is not horribly complicated and may be interesting. So, I ordered EasyCAP D60+ on local website and it arrived in couple of days. I plugged it in USB port and executed lsusb and it says ID 1c88:0007 Somagic, Inc. SMI Grabber (EasyCAP DC60+ clone) [SMI-2021CBE]. Before I ordered I did read up and I was aware that there are four EasyCAP clones, two good ones, one so-so and one bad. Whole introductory story about EasyCAP on Linux is available on Linux TV, here http://linuxtv.org/wiki/index.php/Easycap. That was so-so case. Following instructions from Linux TV I am on easycap-somagic-linux website and now following their instructions. It says install Wine - I hate Wine, but OK. Try to install driver from CD under Wine it reports error. After few attempts, start Windows Server 2003 inside VM, install driver and copy over SmiUsbGrabber3C.sys to extract firmware. Everything goes well and device is initialised, it says now ID is 1c88:003c and time to plug in DVD player and try it. There is no sound but I do not really need it. Here is screen capture of MPlayer:
Not very promising. Try different settings, different capture parameters and most important eject DVD. The last one brings color:
While I got video and even color, it is not usable for what I need it. Attempted capture in Windows inside VM, nothing it is black screen for duration of capture. Give it to my son to install driver to his gaming box - doesn’t want to install, Windows 7 doesn’t like driver and doesn’t want to use it. Try booting into Windows XP, the same story. Maybe it works on Mac? Sorry do not have Mac to try it. Time to put aside Somagic, no magic today, and give to guys from easycap-somagic-linux time to finish driver, it produces some results already.
Ordering more EasyCAP devices with probability of 50% to get usable one or going for more expensive one which works? Think that will go for slightly more expensive device and wait to see it working before I recommend it to anybody.
If anybody managed to use Somagic EasyCAP DC60+ on any operating system, I would like to hear about it, so please leave comment.
Today cheapest Deva, it used to be $275, is gone from the market and others are significantly more expensive. So I advised using Samsung Ultra High Resolution SCB-2000 or similar CCTV camera with sense-up and EasyCAP DC 60 for video capture. What is idea, with sense-up activated up to x512, camera will internally stack up to 512 frames and capture will not take more than few seconds. About any equatorial mount with motor drive must be able to pull few seconds of decent tracking without significant errors. Naturally those cameras are not mach for DSLR camera. They are able to produce 752 × 582 on PAL and with sense-up activated noise ratio is not nominal 50dB. So how pictures actually look like? For example South African amateur astronomer Lucas Ferreira did quite few captures with Samsung SCB-4000 through 10" Newtonian Reflector and his pictures are here http://www.lucastronomy.co.za/Gallery/categories.php?cat_id=17. Looking at picture description we see that complete capture takes about 12 seconds with sense-up x512. While quality is very far from Hubble to get any kind of picture in 12 seconds with any normal camera one needs about two meters of aperture. So, I guess you agree with me CCTV camera can pull maximum out of small 5" Newtonian and even utilize his for proper astrophotography wobbly motor drive.
After giving advice I decided to put together CCTV camera and capture device and plug all that into PC. It is not horribly complicated and may be interesting. So, I ordered EasyCAP D60+ on local website and it arrived in couple of days. I plugged it in USB port and executed lsusb and it says ID 1c88:0007 Somagic, Inc. SMI Grabber (EasyCAP DC60+ clone) [SMI-2021CBE]. Before I ordered I did read up and I was aware that there are four EasyCAP clones, two good ones, one so-so and one bad. Whole introductory story about EasyCAP on Linux is available on Linux TV, here http://linuxtv.org/wiki/index.php/Easycap. That was so-so case. Following instructions from Linux TV I am on easycap-somagic-linux website and now following their instructions. It says install Wine - I hate Wine, but OK. Try to install driver from CD under Wine it reports error. After few attempts, start Windows Server 2003 inside VM, install driver and copy over SmiUsbGrabber3C.sys to extract firmware. Everything goes well and device is initialised, it says now ID is 1c88:003c and time to plug in DVD player and try it. There is no sound but I do not really need it. Here is screen capture of MPlayer:
Not very promising. Try different settings, different capture parameters and most important eject DVD. The last one brings color:
While I got video and even color, it is not usable for what I need it. Attempted capture in Windows inside VM, nothing it is black screen for duration of capture. Give it to my son to install driver to his gaming box - doesn’t want to install, Windows 7 doesn’t like driver and doesn’t want to use it. Try booting into Windows XP, the same story. Maybe it works on Mac? Sorry do not have Mac to try it. Time to put aside Somagic, no magic today, and give to guys from easycap-somagic-linux time to finish driver, it produces some results already.
Ordering more EasyCAP devices with probability of 50% to get usable one or going for more expensive one which works? Think that will go for slightly more expensive device and wait to see it working before I recommend it to anybody.
If anybody managed to use Somagic EasyCAP DC60+ on any operating system, I would like to hear about it, so please leave comment.
Labels:
Astrophotography,
EasyCAP,
Linux,
Somagic EasyCAP,
video astronomy,
Windows
Subscribe to:
Posts (Atom)