Frequency Domain Filtering Problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
parth1
Posts: 7
Joined: 2013-10-29T21:40:19-07:00
Authentication code: 6789

Frequency Domain Filtering Problem

Post by parth1 »

Hello,

The problem with me is that I am getting same image as result after running scripts for low pass filter as well as high pass filter from the following link . http://www.imagemagick.org/Usage/fourier/

Kindly Help

Parth
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Frequency Domain Filtering Problem

Post by fmw42 »

What is your version of IM and platform? Did you install FFTW delegate? It should show when you do

convert -version

Are you running HDRI compile of IM?

What is your exact command? Can you provide the input image?

Please review viewtopic.php?f=1&t=9620
parth1
Posts: 7
Joined: 2013-10-29T21:40:19-07:00
Authentication code: 6789

Re: Frequency Domain Filtering Problem

Post by parth1 »

I am using IM 6.8.7-1 and also I have installed FFTW delegate. Using Ubuntu 13

The problem is when I run command
convert -size 128x128 xc:black -fill white \
-draw "circle 64,64 44,64" circle_r20.png


It is generating expected image with white circle at center of specific radius.

but when I go for Command

convert lena.png -fft \
\( -clone 0 circle_r20.png -compose multiply -composite \) \
\( +clone -evaluate log 10000 -write lena_blur_r20_spec.png +delete \) \
-swap 0 +delete -ift lena_blur_r20.png


The resultant image is same as original lena.png . It is not at all blurring the image.

--Parth
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Frequency Domain Filtering Problem

Post by fmw42 »

Does convert -version show fftw as a delegate? You may have it installed, but IM does not recognize it?

Did you install IM after installing FFTW?
Last edited by fmw42 on 2013-10-30T10:36:00-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Frequency Domain Filtering Problem

Post by fmw42 »

Those commands works fine for me under IM 6.8.7.3 Q16 Mac OSX Snow Leopard.

Be sure you are using the 128x128 version of the lena image.


convert -version
Version: ImageMagick 6.8.7-3 2013-10-25 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC
Delegates: bzlib fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps png tiff x xml zlib
parth1
Posts: 7
Joined: 2013-10-29T21:40:19-07:00
Authentication code: 6789

Re: Frequency Domain Filtering Problem

Post by parth1 »

Yes I have installed IM after installing FFTW.
convert -fft is working fine with my system. I am resizing the lena image to 128x128 before processing it.

But still the result is same. No blurring. I also checked it for HIgh Pass Filter, but result's same.

I dont know about HDRI compile.

Regards,
Parth
parth1
Posts: 7
Joined: 2013-10-29T21:40:19-07:00
Authentication code: 6789

Re: Frequency Domain Filtering Problem

Post by parth1 »

Also the spectrum lena_blur_r20_spec.png is generated. But we cannot find the result from it.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Frequency Domain Filtering Problem

Post by fmw42 »

What does your system return for

convert -version

Does it list fftw? If so what is the version of FFTW on your system?

Does it list OpenMP? If so, perhaps you need to reinstall IM with OpenMP disabled.

As I mentioned above, it works fine for me on IM 6.8.7.3 Q16. I am trying to find out what may be different on your system that might cause a problem. Do you have write permissions for where you are trying to save all the images.

Does this work without creating the spectrum?

Code: Select all

convert lena.png -fft \
\( -clone 0 circle_r20.png -compose multiply -composite \) \
-swap 0 +delete -ift lena_blur_r20.png

P.S. Might you have multiple versions of IM installed on your system. Typical locations are /usr/bin/convert and /usr/local/bin/convert.

You can try

type -a convert

and see if it lists more than one version.
parth1
Posts: 7
Joined: 2013-10-29T21:40:19-07:00
Authentication code: 6789

Re: Frequency Domain Filtering Problem

Post by parth1 »

Yes I am doing work in root.

Convert -version
Version: ImageMagick 6.8.7-1 2013-10-19 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: fftw png png zlib


Also it is not working for code you provided to me.

And for type -a convert
convert is /usr/local/bin/convert
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Frequency Domain Filtering Problem

Post by fmw42 »

Delegates: fftw png png zlib
Why is png listed twice? Oddly, I see it is listed twice in my list also. I will have to notify the IM developers. But this is not the problem, since your commands work for me.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Frequency Domain Filtering Problem

Post by fmw42 »

try the following and see if you get the same results as shown below.

Input:
Image


convert square31.png -fft square31_fft_mp.png
Image
Image

convert square31_fft_mp-0.png -auto-level -evaluate log 10000 square31_fft_mp-0_al_log10000.png
Image
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Frequency Domain Filtering Problem

Post by glennrp »

PNG is listed twice for me, too. It seems to be due to a cut-and-paste
error in GetMagickDelegates (in magick/version.c). I've fixed that
in the SVN repository for IM6 and IM7. The fix should show up in
IM-6.8.7-5.
  • glenn.rp> q16convert -version
    Version: ImageMagick 6.8.7-3 2013-10-24 Q16 http://www.imagemagick.org
    Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
    Features: DPC
    Delegates: fontconfig freetype jng jpeg png png x xml zlib
Last edited by glennrp on 2013-10-31T19:03:54-07:00, edited 1 time in total.
parth1
Posts: 7
Joined: 2013-10-29T21:40:19-07:00
Authentication code: 6789

Re: Frequency Domain Filtering Problem

Post by parth1 »

Also OpenMP is listed in Features
parth1
Posts: 7
Joined: 2013-10-29T21:40:19-07:00
Authentication code: 6789

Re: Frequency Domain Filtering Problem

Post by parth1 »

Square31.png is getting the same result as u mentioned above. They are working fine with my system.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Frequency Domain Filtering Problem

Post by fmw42 »

parth1 wrote:Square31.png is getting the same result as u mentioned above. They are working fine with my system.
Then are you sure that the circle image looks correct?

parth1 wrote:Features: DPC OpenMP
What is DPC?



Does make any difference if you turn alpha off after creating the circle?

convert -size 128x128 xc:black -fill white -draw "circle 64,64 44,64" -alpha off circle_r20.png

Try the above and check the circle image. Then try

Code: Select all

convert lena.png -fft lena_fft_mp.png
convert lena_fft_mp-0.png circle_r20.png -compose multiply -composite lena_fft_mag_filtered.png
convert lena_fft_mag_filtered.png lena_fft_mp-1.png -ift lena_blur_r20.png
Post Reply