Saturday 5 June 2010

Unlock the power of ImageMagick to HDRI

My primary motivation to do this has been to use ImageMagick for Fast Fourier Transforms, which have a myriad of applicability in image processing and filtering

First, you have to install perlmagick. Using apt,
 sudo apt-get install perlmagick  


Then the perl libraries
 sudo apt-get install libperl-dev  


Install the rather magnificent fftw libraries
 sudo apt-get install libfftw3-dev fftw-dev  


wget the source code, untar, move it, cd home
 wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz   
tar xvfz ImageMagick.tar.gz
mv ImageMagick-6.6.0-8 $HOME
cd $HOME/ImageMagick-6.6.0-8


Install (see here for instructions)
 make distclean   
./configure --enable-hdri LDFLAGS='-L/usr/local/lib -R/usr/local/lib'


see also here for a bug fix, and also see here for instructions

make & sudo make install
make check


To see whether the fft commands are working properly, you could issue the following:
 if [ -s lena.png] #check to see if the file exists  
then
# do fft and ifft roundtrip
convert lena.png -fft -ift lena_mp_roundtrip.png
else
#first download
wget http://optipng.sourceforge.net/pngtech/img/lena.png
#then convert
convert lena.png -fft -ift lena_mp_roundtrip.png
fi


see here for further information on fft transforms with, and watch your world spin faster

No comments: