I have a image and in my homework I must calculate fourier transform of it and recover it by 3 different value
- with min of magnitude values
- with median of magnitude values with 25%
- percentage of magnitude values
my main picture is
and after run my script
I=imread('image number one.bmp');
gI=rgb2gray(I);
imafft = fft2(single(gI));
% Gets magnitude and phase.
mag = abs(imafft);
phi = angle(imafft);
% Generates the modified spectrum
magvector=mag(:);
myones=ones(size(mag));
percent25 = prctile(magvector,25);
minfft = min(magvector).*exp(i*phi);
medianfft = myones .* median(magvector).*exp(i*phi);
percentfft = myones.*percent25.*exp(i*phi);
figure;
subplot(131);
imagesc(abs(ifft2(minfft)));
title('with min of magnitude');
subplot(132);
imagesc(abs(ifft2(medianfft)));
title('with median of magnitude');
subplot(133);
imagesc(abs(ifft2(percentfft)));
colormap(gray);
title('with 25 percentage of magnitude');
Is my result correct and recovering image with min and median and 25% of magnitude are similar each other?
my main question and problem is really how I calculate median of magnitude?
apreciate any help