IDL programming issue - Fourier transform

Click For Summary
SUMMARY

The discussion focuses on an IDL programming issue related to the Fourier transform and convolution theorem. The user attempted to convolve a 3x3 kernel, zeropadded to 256x256, with a 256x256 image array using FFT. The resulting filtered image appears darker than expected, leading to speculation about potential issues with non-integer values in the array. The user seeks clarification on whether this discrepancy is due to rounding problems or other factors in the IDL implementation.

PREREQUISITES
  • Understanding of Fourier Transform and its applications in image processing
  • Familiarity with IDL programming language and its syntax
  • Knowledge of convolution operations in the spatial and frequency domains
  • Experience with FFT (Fast Fourier Transform) and its implementation
NEXT STEPS
  • Investigate IDL's handling of non-integer arrays and potential rounding issues
  • Learn about the implications of zeropadding in FFT operations
  • Explore the convolution theorem in detail, particularly in the context of image processing
  • Examine the use of the 'tvscl' function in IDL for visualizing filtered images
USEFUL FOR

Researchers, image processing engineers, and programmers working with IDL who are troubleshooting Fourier transform and convolution-related issues in their projects.

big man
Messages
242
Reaction score
0

Homework Statement


By the convolution theorem one would expect that if you convolved your image with a kernel in the spatial domain, you would get the exact same result if you multiplied the FFT of the image array by the FFT of the kernel.

My problem is that I don't get the same results.

3. What I did:
1. I first zeropadded the 3x3 kernel so that it was a 256x256 array.
2. I took the FFT of the zeropadded kernel and I took the FFT of the image array (256x256)
3. I multiplied these together and then took the inverse FFT to get the filtered image.

In doing this I get a darker image from the convolution in the spatial domain. I mean I have a non-integer array (no longer an integer greyscale array) which I think is the problem. Does anyone have any ideas as to why this is?? If it helps I've copied the code for this below.


kernel1zero=fltarr(256,256)
kernel1zero[0:2,0:2]=kernel1/(total(kernel1))
kernel1zero[3:255, 3:255]=0

convolfre1=fftscan2*(fft(kernel1zero))
inconvofre1=fft(convolfre1, /inverse)


window, 8, xsize=512, ysize=256
tvscl, abs(inconvofre1), 1

Thanks in advance for any help.
 
Physics news on Phys.org
This is just a guess since I have no idea about IDL, but could you have a rounding problem? Try increasing the number of significant digits if you can.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K