数字图像处理(频域、空域处理基础)

将图像从空间域通过傅里叶变换等变换转换到频域,目的在于更好处理且计算速度快。

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');

发布了40 篇原创文章 · 获赞 3 · 访问量 7593

猜你喜欢

转载自blog.csdn.net/OpenSceneGraph/article/details/101052866
今日推荐