0
我有一張由2張相同圖像組成的圖像,其中一張被翻譯。使用頻域進行圖像處理 - 複製圖像
現在,我要修復它。我使用變換傅立葉變換的性質如下:
$ f(x-x_0,y-y_0)\ leftrightarrowF(u,v)e^{ - 2 {\ pi} i(ux_0/{N} + vy_0/M)} $
我測量了兩幅圖像之間的距離:x距離是24像素,y距離是4像素。在代碼中:x_d和y_d。
然後,我剛剛從公式+ 1(1來自未翻譯的圖像)指數表達式的頻域圖像中的所有像素。
我想不出什麼問題...
這是我的代碼:
function [ ] = f()
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
FileName='dog.tif';
%--- Read Image ---
im = readImage(FileName);
imshow(im);
%--- apply FFT on the given image ---
fftIm = fftshift(fft2(im));
%--- apply LOG and abs for plotting the transform ---
fLog = log(1 + abs(fftIm));
%----modify the image in the frequency domain-------
fftImMod=fftIm;
x_d=24; %x distance between the 2 images
y_d=4; %y distance between the 2 images
N = 305; %the dimensions of the image NxM = 305x305
M = 305; %the dimensions of the image NxM = 305x305
for r=1:size(fftIm,1)
for k=1:size(fftIm,2)
divisionVal = 1+exp((-2*(pi)*1i)*(r*x_d/N + k*y_d/M));
fftImMod(r,k)=fftIm(r,k)/divisionVal;
end;
end;
%--- apply LOG and abs for plotting the modified transform ---
fLogAfterMod = log(1 + abs(fftImMod));
%--- return to the image space ---
result=ifft2(fftshift(fftImMod));
% --- display results ---
colormap(gray)
subplot(2,2,1),imagesc(im); title('Original Image')
subplot(2,2,2),imagesc(fLog); title('Fourier Image')
subplot(2,2,3),imagesc(fLogAfterMod); title('Modified Fourier')
subplot(2,2,4),imagesc(real(result)); title('Result Image')
end
這裏是結果:
result
任何幫助將不勝感激。 謝謝。
你想要做的是註冊。看看ImageJ中的TurboReg插件,它確實很好。我知道一些基本的算法也已經在MatLab中實現。 – FiReTiTi
謝謝,但不幸的是我不能使用插件。 – daniel
所有的源代碼(基本的Java)也可用,以防萬一你想翻譯它。我對註冊有很大的需求,TurboReg是我發現的最好的算法。 – FiReTiTi