資源簡介
圖像傅里葉變換和幅度、相位譜重組Matlab程序。有附圖,可自行替換

代碼片段和文件信息
I1=imread(‘A.jpg‘);
I2=imread(‘B.jpg‘);
I1=im2double(I1);?I2=im2double(I2);
F1=fft2(I1);?F2?=?fft2(I2);??????%傅里葉變換
F1=fftshift(F1);?F2?=?fftshift(F2);
margin1=log(abs(F1));?margin2?=?log(abs(F2));
phase1=log(angle(F1)*180/pi);?phase2=log(angle(F2)*180/pi);
%subplot(221)imshow(margin1[])title(‘A圖像幅度譜‘);
%subplot(222)imshow(phase1[])title(‘A圖像相位譜‘);
%subplot(223)imshow(margin2[])title(‘B圖像幅度譜‘);
%subplot(224)imshow(phase2[])title(‘B圖像相位譜‘);
imwrite(margin1‘Am.jpg‘);imwrite(margin2‘Bm.jpg‘);
imwrite(phase1‘Ap.jpg‘);imwrite(phase2‘Bp.jpg‘);
margin1?=?exp(margin1);?phase1?=?exp(phase1)*pi/180;
margin2?=?exp(margin2);?phase2?=?exp(phase2)*pi/180;
G1?=?margin1.*exp(j*phase1);
G1?=?ifftshift(G1);
J1?=?ifft2(G1);
G2?=?margin2.*exp(j*phase2);
G2?=?ifftshift(G2);
J2?=?ifft2(G2);
G3?=?margin1.*exp(j*phase2);
G3?=?ifftshift(G3);
J3?=?ifft2(G3);
G4?=?margin2.*exp(j*phase1);
G4?=?ifftshift(G4);
J4?=?ifft2(G4);
subplot(221)imshow(J1)title(‘A圖像復原‘);
subplot(222)imshow(J2)title(‘B圖像復原‘);
subplot(223)imshow(J3)title(‘A幅度?B相位‘);
imwrite(J3‘Am_Bp.jpg‘);
subplot(224)imshow(J4)title(‘B幅度?A相位‘);
imwrite(J4‘Ap_Bm.jpg‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????98??2018-12-27?16:18??說明.txt
?????文件?????237659??2018-11-28?19:38??A.jpg
?????文件?????150596??2018-11-28?19:39??B.jpg
?????文件???????1228??2018-11-29?16:21??forr.m
-----------?---------??----------?-----??----
???????????????389581????????????????????4
- 上一篇:手寫數字識別.貝葉斯分類算法
- 下一篇:FastICA2.5
評論
共有 條評論