ImageMagick Now Has Fourier Transforms

Announcements pertaining to ImageMagick, or ImageMagick related software. This list is moderated. No discussions here, instead post to the users group instead.

ImageMagick Now Has Fourier Transforms

Postby fmw42 » 2009-07-19T16:58:36+00:00

Thanks to the heroic efforts of Magick, IM version 6.5.4-3 now has Fourier Transforms. See the options -fft and -ift.

My thanks to Magick for his time, energy and tenacity to implement the demo that Sean Burke and I originally developed. This was no easy task contrary to my naive belief.

This initial implementation has one notable feature that should be considered by any user. The resulting FFT image(s) will be square with even dimensions. This means that if the input image does not conform to this requirement, it will be automatically padded to conform. Thus, after doing a -fft followed by any processing and then a -ift, the resulting image will contain the pad. The padding will have to be cropped manually as a post processing step.

I hope in the future that the square limitation will be removed.

Over the next few days, I will be writing up some detailed documentation with examples of what one can do with the Fourier transform. My old notes and examples at http://www.fmwconcepts.com/misc_tests/F ... index.html are out-dated. They demonstrate much of what can be done, but the syntax for creating the transform images and structure of the transform images are now much different. I hope to contribute this documentation to Anthony's excellent pages at http://www.imagemagick.org/Usage/ and will be working with Anthony to fold them in.

The FFTW delegate library is needed to use the IM FFT and IFT options. see http://www.fftw.org/

Fred
User avatar
fmw42
 
Posts: 15028
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: ImageMagick Now Has Fourier Transforms

Postby fmw42 » 2010-03-24T19:22:35+00:00

As of IM 6.6.0-9, Fourier Transform functions in ImageMagick should now work properly for Windows users (thanks to user el_supremo).

Note that one has to install the FFTW delegate and then recompile IM from source.

Fred
User avatar
fmw42
 
Posts: 15028
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: ImageMagick Now Has Fourier Transforms

Postby fmw42 » 2010-03-25T18:25:50+00:00

Compliments of user el_supremo!

For Windows Users:

These instructions describe how to recompile IM with the HDRI and FFTW options using an MSVC compiler.
Download and unzip the latest ImageMagick source distribution from http://www.imagemagick.org/script/insta ... hp#windows
Download the current FFTW binary from http://www.fftw.org/install/windows.html and unzip it to a directory such as c:\fftw-3.2.2 and then read the file README-WINDOWS. In order to use the DLL with IM you must run the lib command as described in that file. You only need to do it for whichever floating point format your system uses - the default is 32-bit double. The others are float (f) or long double (l). For the default, just execute this command in the directory:
lib /def:libfftw3-3.def
This file is essential to the build process as it is required by the linker when IM is built.

Start up the Control Panel program, select System|Advanced|Environment Variables and add c:\fftw-3.2.2 to the System's PATH environment variable so that the system can find the DLL whenever an IM command is executed.

Building configure:
Start up MSVC and select the configure solution in visualmagick\configure. Select Build|Configuration Manager and change the build configuration to Release. Now build the program.
Run the configure program. In the dialog, click Next. In the next dialog window, select "Edit magick-config.in". This will start up notepad and allows you to edit the file. Check that MAGICKCORE_QUANTUM_DEPTH is the required value (16 is best when using FFTW and/or HDRI) then check that MAGICKCORE_HDRI_SUPPORT is defined. Finally, after HDRI, add this:
#define MAGICKCORE_FFTW_DELEGATE
Save the file and then click through the rest of the configure dialog. The program will then write your selected configuration and create a solution file which you then use to build IM.

To build IM, run MSVC again and open the solution file that configure writes in the VisualMagick directory (e.g. VisualDynamicMT.sln).
If you want a Release version of IM, change the build configuration to Release in the same way as described above for the configure program.
Before compiling, the properties of the Core_Magick project must to be modified. Find that project in the list, right click on it and select Properties:
- in C/C++|General|additional includes add the path to the fftw directory: c:\fftw-3.2.2
- in linker|General|additional libraries directory add the path to the fftw directory: c:\fftw-3.2.2
- in linker|Input|additional dependencies add libfftw3-3.lib
(Note that when you make changes to these properties you must select "Apply" or the change won't take effect)
It's best to clean the solution before doing a build but now you can do the build. Once it has finished, the DLL and EXE files will be in VisualMagick\bin
User avatar
fmw42
 
Posts: 15028
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: ImageMagick Now Has Fourier Transforms

Postby fmw42 » 2011-06-16T09:57:12+00:00

Compliments of Filip Dominec -- notes on compiling IM and FFTW on Ubuntu:

sudo apt-get install fftw-dev libjpeg62-dev libjpeg8-dev
sudo apt-get install libfftw3-3 libfftw3-dev
apt-get source imagemagick
cd im*
./configure --enable-hdri --disable-shared --with-jp2=yes --with-jpeg=yes --with-lqr --with-fftw=yes make
make install
User avatar
fmw42
 
Posts: 15028
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA


Return to Announce

Who is online

Users browsing this forum: No registered users and 1 guest