if true
end
clc
Proj2Image = 'Proj2.tif';
[img,map] = imread(Proj2Image);
figure
imshow(img,map);
title('Original Image');
img = img(:,:,1);
imgfft = fft2(img);
c = 2;
X = size(imgfft, 1);
Y = size(imgfft, 2);
A = ones(X,Y);
XX = [204 182 191 196 214 219 228];
YY = [273 275 267 282 264 279 271];
L = 255;
for i=1:length(L)
for x = 1:X
for y = 1:Y
Lxy = sqrt((x-XX(i))^2 + (y-YY(i))^2);
A(x,y) = A(x,y) + 1/(1+(Lxy/L(i)^2))^(2*c);
end
end;
end;
FilterImage = fftshift(imgfft).*A;
figure
imshow(abs(FilterImage),[]);
title('Image After Shifting by FFT and Multiplying By A');
FilterImage2 = ifft2(fftshift(FilterImage));
figure
imshow(abs(FilterImage2),[]);
title('Shifting Back and Performing Inverse FFT');
[img,map] = imread('periodicpattern.tif');
figure('Name','Periodic Pattern Comparison');
subplot(1,2,1), imshow(abs(FilterImage2),[]);
title('Periodic Pattern of Image');
subplot(1,2,2), imshow(img,map);
title('periodicpattern.tif');
So I've been debugging this program for a few days now. I still can't seem to get to correct output that I'm looking for though. The program currently displays 4 figures, which is exactly what I want. However, the output images in Figure 3 and Figure 4 need to be modified a little bit.
What I'm trying to do is take the original image 'Proj2.tif', extract the mesh periodic cross pattern out of it, and display that mesh pattern in Figure 3. I also want that image to appear in the left-hand side of Figure 4 so I can prove that extracting the periodic pattern of the image can be done by applying the FFT, Shifting It, Multiplying it by an array of ones, Shifting it back, and performing the inverse FFT.
I provided the .jpg format of the original image to you guys in this forum since the forum board won't accept .tif files for some reason.
Obviously, the method I'm using currently to try to get this result isn't working. I thought about using a log function in Line 66 and Line 74 to fix this, but that strategy isn't working either.
By the way, this is Line 66 and Line 74 respectively below:
imshow(abs(FilterImage2),[]); %Line66
subplot(1,2,1), imshow(abs(FilterImage2),[]); %Line77
Any feedback or help on this problem would be greatly appreciated.