Page 1 of 1

Problem with memor allocation (i suppose)

Posted: 2015-05-28T06:34:12-07:00
by Gogolian
Hello,

This is my first post here so please be gentle

I already tried searching for solutions and decided that i will most probably need some help.

I would like to do the fast fourier transform on very large image 24288x14968.

Currently i am on windows at work.

I have a downloaded version of imagemagic with fft transform.

I first tried on the clown.jpg test file to check if it works and it did, both ways, with successfully clearing out unwanted patterns.

My code for this was:

Code: Select all

.\convert -monitor Zdjecie1.png -fft ( +clone -write clown_phase.png +delete ) +delete -write clown_magnitude.png -colorspace gray -auto-level -evaluate log 100000 clown_spectrum.png
then making a mask (i am making it by hand)

and then the inverse:

Code: Select all

.\convert -monitor clown_magnitude.png clown_spectrum_mask.png -compose multiply -composite clown_phase.png -ift clown_filtered.png
Now i switched to my big picture.

It loads the file, starts making 'clown_phase.png' file, you can see it inflating to 258466 Kb (Original file filesize is 1 065 263Kb), and then crashed:

Code: Select all

convert.exe: Memory allocation failed `Zdjecie1.png' @ error/fourier.c/ForwardFo
urierTransformChannel/597.
I tried tweaking limits different ways, the last one is like this:

Code: Select all

.\convert -limit area 128MB -limit disk 50GB -limit map 512MB -monitor Zdjecie1.png -monitor -fft -monitor ( +clone -write clown_phase.png +delete ) +delete -write clown_magnitude.png -colorspace gray -auto-level -evaluate log 100000 clown_spectrum.png
but no luck, it inflates the file every time to the same size.

I'm out of ideas, besides the one that when i go home i can install ubuntu or mint and try compiling IM from source and then try to run it there.

I am afraid that it won't make any difference though.

Is there any limit on fourier transform at all?

Re: Problem with memor allocation (i suppose)

Posted: 2015-05-28T09:52:08-07:00
by fmw42
I know of no size limitation of FFTW and have seen references to image sizes up to 2^31. I suspect that your -limits may be off and you are exceeding memory allocation. But one of the IM developers will likely need to comment.

Re: Problem with memor allocation (i suppose)

Posted: 2015-05-28T12:31:10-07:00
by magick
Make sure you have a modern version of ImageMagick, it forces the FFTW allocation to disk rather than memory for large resource requests. Your limits should be '-limit memory 2MB'. By making the memory limits small, it forces the allocation to memory mapped disk. Thus you don't want to limit the memory map limit. With memory-mapped backed disk, it will run slower than if the allocation is directly in memory but it should complete.