數字圖像處理(頻域、空域處理基礎)

將圖像從空間域通過傅里葉變換等變換轉換到頻域,目的在於更好處理且計算速度快。

1.頻域處理基礎

通過狄裏赫萊條件(有限個間斷點、有限個極值點、絕對可積)定義傅里葉變換。 

通過了解FT的性質對圖像進行處理。

 上機實現:

m=imread('D:\Imagematlab\1.jpg');
t=rgb2gray(m);
figure;
imshow(t);
R=fftshift(fft2(t));%fft
figure;
imshow(log(abs(R)),[]);
figure;
r2=dct2(t);
imshow(log(abs(r2)),[]);%dct

2.空域點處理

 

 僞彩色處理 or 假彩色處理:

僞彩色處理--灰度圖像變爲彩色圖像,對比度增強、圖像恢復。

假彩色處理--映射成奇異彩色引人注目;利用人眼對彩色的敏感度提高鑑別能力;遙感圖像處理獲得更多信息。

I=imread('cat.jpg');
I=rgb2gray(I);
% I=im2double(I);
% a=2;b=-55;
% R=a.*I+b/255;%線性運算
% figure(1);
% imshow(R);
% R=2.5*log(I+1);%非線性運算
% figure(2);
% imshow(R);
% R=1.0*I.^4.5;%冪運算
% figure(3);
% imshow(R);

% imhist(I);
% R=histeq(I);
% figure;
% imshow(R);
% title('均衡化');

% J=imnoise(I,'salt & pepper',0.02);
% subplot(2,3,1);imshow(I);title('原圖像');
% subplot(2,3,2);imshow(J);title('添加椒鹽噪聲');
% R1=filter2(fspecial('average',3),J);%3*3模板均值濾波
% R2=filter2(fspecial('average',5),J);
% R3=filter2(fspecial('average',7),J);
% R4=filter2(fspecial('average',9),J);
% subplot(2,3,3);imshow(uint8(R1)),title('3*3模板均值濾波');
% subplot(2,3,4);imshow(uint8(R2)),title('5*5模板均值濾波');
% subplot(2,3,5);imshow(uint8(R3)),title('7*7模板均值濾波');
% subplot(2,3,6);imshow(uint8(R4)),title('9*9模板均值濾波');
% 
% figure(2);
% subplot(2,3,1);imshow(I);title('原圖像');
% subplot(2,3,2);imshow(J);title('添加椒鹽噪聲');
% R1=medfilt2(J);
% R2=medfilt2(J,[5 5]);
% R3=medfilt2(J,[7 7]);
% R4=medfilt2(J,[9 9]);
% subplot(2,3,3);imshow(R1),title('3*3');%中值模板
% subplot(2,3,4);imshow(R2),title('5*5');
% subplot(2,3,5);imshow(R3),title('7*7');
% subplot(2,3,6);imshow(R4),title('9*9');

% figure;
% subplot(1,3,1);imshow(I);
% H=fspecial('Sobel');
% H=H';%Sobel垂直模板
% R=filter2(H,I);
% subplot(1,3,2);imshow(R,[]);
% H=H';%Sobel水平模板
% R=filter2(H,I);
% subplot(1,3,3);imshow(R,[]);
% 
% figure(2);
% subplot(2,3,1);imshow(I);
% [R,t]=edge(I,'log');
% subplot(2,3,2);imshow(R);title('LOG算子檢測邊緣');
% R=edge(I,'Sobel');
% subplot(2,3,3);imshow(R);title('Sobel算子檢測邊緣');
% R=edge(I,'Prewitt');
% subplot(2,3,4);imshow(R);title('Prewitt');
% R=edge(I,'Roberts');
% subplot(2,3,5);imshow(R);title('Roberts');

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章