一、利用反转变换实现图像增强
clc;
clear;
f=imread('breast.tif');
g=255-f;
subplot(121);
imshow(f);
subplot(122);
imshow(g);
![《数字图像处理在Matlab的实现[1]》](http://vegoblogoss.oss-cn-hongkong.aliyuncs.com/2020/04/1.bmp)
过灰度变换获得明暗反转图像的过程可用于增强嵌在大片黑色区域中的白色或灰色细节,在医学图像增强处理.上经常使用。
二、利用MATLAB提供的直方图修正函数对图像做直方图均衡化处理
clc;
clear;
I=imread('tire.tif');
J=histeq(I);
subplot(221); imshow(I)
subplot(222); imshow(J)
subplot(223); imhist(I,64)
subplot(224); imhist(J,64)
![《数字图像处理在Matlab的实现[1]》](http://vegoblogoss.oss-cn-hongkong.aliyuncs.com/2020/04/2.bmp)
三、使用filter2 函数和fspecial 函数来实现图像平滑滤波效果,对一幅图像进行不同大小的模板的均值滤波,并比较结果。
clc;
clear;
I=imread('eight.tif');
J=imnoise(I,'salt & pepper',0.02); %给图像加入椒盐噪声
subplot (1,2,1);
imshow (I);
title('原始图像');
subplot(1,2,2);
imshow(J) ;
title('噪声图像');
IM1=filter2 (fspecial ('average',3),J)/255; %进行3X 3的均值滤波
IM2=filter2 (fspecial ('average',5),J)/255; %进行5X 5的均值滤波
IM3=filter2 (fspecial ('average', 7),J)/255;%进行7X 7的均值滤波
IM4=filter2 (fspecial ('average',9),J)/255; %进行9X 9的均值滤波
figure ;
subplot(2,2,1) ; imshow (IM1) ;title('3X3模板均值滤波');
subplot(2,2,2) ; imshow (IM2) ;title('5X5模板均值滤波');
subplot(2,2,3) ; imshow (IM3) ;title('7X7模板均值滤波');
subplot(2,2,4) ; imshow (IM4) ;title('9X9模板均值滤波');
![《数字图像处理在Matlab的实现[1]》](http://vegoblogoss.oss-cn-hongkong.aliyuncs.com/2020/04/3.bmp)
四、使用filter2函数和fspecial函数来实现边缘锐化效果。
clc;
clear;
f=imread('moon.tif');
w4=fspecial('laplacian',0);
w8=[1 1 1;1 -8 1;1 1 1];
f=im2double(f);
g4= imfilter(f,w4,'replicate');
g8=imfilter(f,w8,'replicate');
G4=f-g4;
G8=f-g8;
imshow(f);
figure,imshow(G4);
figure,imshow(G8);
![《数字图像处理在Matlab的实现[1]》](http://vegoblogoss.oss-cn-hongkong.aliyuncs.com/2020/04/4.jpg)
专业
你是哪位兄弟呀
您猜
老板隐藏太深,猜不出来