Dear Signal Processing readers,
I want to introduce 'noise' into parts of images.
Until now, I worked with rectangluar images for a similar purpose and did the following, using (inverse) Fourier transform (2D) with MATLAB:
fft = fft2(image); % run fourier transform on image amplitude = abs(fft); % extract power spectrum> newPhase = ( (rand(size(amplitude)) * 2) - 1) * pi; %generate random phase newImage = real(ifft2(amplitude. * exp(1i * newPhase))); %use both to generate noised image
This randomizes the phase all over the image, preserving the power spectrum and should guarantee the same spatial frequency spectra in input and output.
What I want to do now, is applying this effect to only a part of an image, which is not rectangular (its the "inner" parts of a face and will fit in an ellipse). So I want to "cut out" this ellipse from an image, turn it to "phase noise" (with power spectrum/spatial frequencies constant) as above, and but it back into the "hole" I cut out of the source image before.
My "prime solution" of course would be that FFT/iFFT could operate on ellipses as well, so I could keep using my method shown above. After some amount of google-ing I am quite pessimistic about that option - is there any hope?
I found the following traces to possibly promising approaches, but as I am not very familiar with the math behind FFT, I'd appreciate any hint/explanation (why) which of these ideas go into a good direction:
- Somehow "stretch" the ellipse to a rectangle shape, apply my method as is, strech the resulting rectangle back to the input ellipse shape. Here I fear that the rectangle/ellipse-transformation might destroy the matched power spectrum. Do you know good way of transforming without loosing this information? (This led me to this idea)
Two more hints came from this post:
- Using a 3D-fourier transform, in which (as far as I got it) the 3rd dimension gives information about which part of the image shall be used. Any idea / experience how to implement this?
Using "Elliptic Discrete Fourier Transform" - but I do not understand what (and how) it does and how it can be implemented.
In this forum, someone suggested to a related question some sort of window tapering (which, as far as I got it, is made to "filter" the influence that only comes into the image because the ellipse of interest is on a black background) that I did not understand as well, plus i am not sure if it could help me because it did not sound like that question would require an ellipse as output.
Thanks in advance for any suggestion!