I've got a real 2D image of propagating waves in both directions. How can I separate this image into one with the upward-propagating waves and one with the downward-propagating ones?
This example has one wave in each direction. The x-scale shows time, the y-scale shows position, and intensity shows the amplitude of the wave at that position and time. The first image is my input.
However, I'm not very used to 2D signal processing, so the way I'm doing this is by just setting two quadrants of the FFT spectrum to zero and then reverse-transforming back. I got the other two images using the following algorithm:
X = fftshift(fft2( x )); % x is the input (image above) X( 1:floor(size(X,1)/2), 1:floor(size(X,2)/2) ) = 0; % null 1st quadrant X( ceil(size(X,1)/2)+1:end, ceil(size(X,2)/2)+1:end) = 0; % null 3rd quadrant y = ifft2( ifftshift(X) ); y = real( y ); % y is the output (image above)
It feels like such a barbaric method would introduce all kinds of artefacts, so I'm looking for feedback from someone more experienced.
- Is there a better way to achieve this?
- How should I "soften" the edges of the 0/1 "mask" I'm multiplying the FFT with?
- The output is complex, so I'm discarding the imaginary part. Is that correct?
- I'm also a bit worried about the fact that the noise will not be white anymore, but I suppose there isn't much to do about that except for low-pass filtering the whole image.