# How to find wavelength of a wave in an image

70 views (last 30 days)
Paul T John on 26 Aug 2011
I got an answer and it helped me a lot. Nevertheless, I have two more doubts:
1) I did the 2D FFT and cleared the DC component. Image is seen here: http://www.flickr.com/photos/paultjohn/6062522739/
Now, how can I relate the peaks in the spectral image to the colour waves and also to the grids - which peak corresponds to which?
2) Also, once I find out the Fx and Fy of the peak and get the wavelength in each direction, how can I find the resultant wavelength of the propagating wave?
These questions may sound naive, but please bear with me and kindly give some insight into the problem.
Regards, Paul T John

Rick Rosson on 27 Aug 2011
Hi Paul,
Best of luck,
Rick
Paul T John on 27 Aug 2011
It's okay Rick. You had been a great help by providing all the previous answers. Thanks a lot for helping me to achieve at least this much.
Regards,
Paul

Rick Rosson on 26 Aug 2011
Once you find Fx and Fy, you can use the Pythagorean Theorem to find the overall frequency F:
F = sqrt(Fx^2 + Fy^2); % cycles per centimeter
In looking at the source image, however, it seems like the waves are primarily traveling in the X-direction, particularly in the middle part of the image (crop the image by eliminating the top 40 percent and bottom 25 percent of the image, and then you are left with just the middle part). So that suggests that Fy should be essentially zero, in which case the overall frequency F is approximately equal to just Fx.
Once you have computed F, you can then find the wavelength:
L = 1/F; % centimeters
I would suggest that you break the image up into three sub-images, called top, middle, and bottom:
[M,N,P] = size(cimg);
h = floor(0.40*M);
k = floor(0.75*M);
top = cimg(1:h,:,:);
middle = cimg(h+1:k,:,:);
bottom = cimg(k+1:end,:,:);
Then, I would repeat your analysis on each of these three sub-images. I think you will find that the peaks in each image will be much more obvious. For the middle image in particular, you should see three definite peaks: one located at Fx = 0, and two others at Fx=+Fo and Fx=-Fo. There will be no major peaks in Fy except at Fy=0.
HTH.
Rick
##### 2 CommentsShowHide 1 older comment
Rick Rosson on 26 Aug 2011
I have revised my answer to include Question (1).

Rick Rosson on 26 Aug 2011
I have updated my previous answer to include a method for addressing Question (1).
Paul T John on 27 Aug 2011
Rick, thank you for finding time to help me. I tried the way you mentioned. Yes, the peaks are more obvious. However, isn't the value at (Fx = 0, Fy = 0) zero, as the DC component is removed? Or is it because the way I write the command (after doing fftshift): 'surf(Fx, Fy, sectionfft)' wrong?
I have attached the entire code as another answer.

Paul T John on 27 Aug 2011
Here is the complete picture of what I'm trying to do:
Objective & Background: I have six images in which the waves are propagating with a specific frequency. The frequencies are:
• 45 kHz
• 75 kHz
• 76 kHz
• 85 kHz
• 95 kHz
• 105 kHz
I am trying to find the wavelength in all the six cases.
It is seen from the images that the wavelength progressively decreases (from first image to sixth image). Also, all the images are of same pixel size and the grid-position is exactly the same in all the images.
Hypothesis: Since the grid is fixed in all cases, there should be a commonality (such as a peak with same co-ordinates for frequencies Fx and Fy) in all the six spectral images. The common peak corresponds to grid and the other notable peak would correspond to the colour wave whose co-ordinates would, in turn, give the wavelength.
What I got: Almost all the peaks have more than one set of co-ordinates in common. Hence, I cannot identify which set corresponds to grid and which one to peaks. For instance, the set ( Fx = 1.704, Fy = -0.5445) as well as ( Fx = 5.964, Fy = -0.5445) appears in almost all the spectra.
I have included the source images, codes, MATLAB figures ( .fig ) and a pdf of tabulated values for Fx and Fy for all peaks in this .zip file (size: 9.44 MB)