东北大学数字图像处理实验.doc
文本预览下载声明
数字图像处理
一、实验目的
(1)学会使用扫描仪;
(2)熟悉MATLAB软件。
二、实验内容
(1)用扫描仪扫一幅彩色图片;一幅灰度图片。
(2)熟悉MATLAB的主界面窗口中各个窗口的功能,利用不同的矩阵输入方式给矩阵赋值,了解MATLAB的简单编程及矩阵基本知识;
(3)掌握使用MATLAB的帮助来获得更多的信息。
三、实验仪器设备
扫描仪、计算机和MATLAB应用软件。
实验二:图像处理
一、实验目的
(1)通过应用MATLAB语言编程实现对图像的处理,进一步熟悉MATLAB软件的编程及应用;
(2)通过实验进一步掌握图像处理的基本技术和方法。
二、实验内容
应用MATLAB语言编写显示一幅灰度图像、二值图像、索引图像及彩色图像的程序,并进行相互之间的转换;
(1)显示一:
:I=imread(cs.jpg);
imshow(I)
效果:
(2)RGB转灰度图像
代码:
graycs=rgb2gray(I);
subplot(1,2,1);
subimage(I)
subplot(1,2,2);
subimage(graycs)
效果:
(3)RGB转索引图像
代码: [indcs,map]=rgb2ind(I,0.7);
subplot(1,2,1)
subimage(I);
subplot(1,2,2);
subimage(indcs,map)
效果:
(4)索引图像转RGB
代码:I1=ind2rgb(indcs,map);
subplot(1,2,1);
subimage(indcs,map);
subplot(1,2,2);
subimage(I1);
效果:
(5)索引图像转灰度图像:
代码:i2gcs=ind2gray(indcs,map);
subplot(1,2,1);
subimage(indcs,map);
subplot(1,2,2);
subimage(i2gcs,map);
效果:
(6)灰度图像转索引图像
代码:
[g2ics,map]=gray2ind(graycs,64);
subplot(1,2,1);
subimage(graycs);
subplot(1,2,2);
subimage(g2ics,map);
效果:
(7)RGB转二值图像
代码:
r2bwcs=im2bw(I,0.5);
subplot(1,2,1);
subimage(I);
subplot(1,2,2);
subimage(r2bwcs);
效果:
(8)灰度图像转二值图像
代码:
g2bwcs=im2bw(graycs,0.5);
subplot(1,2,1);
subimage(graycs);
subplot(1,2,2);
subimage(g2bwcs);
效果:
(9)索引图像转二值图像
代码:i2bwcs=im2bw(indcs,map,0.7);
subplot(1,2,1);
subimage(indcs,map);
subplot(1,2,2);
subimage(i2bwcs)
效果:
2.应用MATLAB工具箱演示一幅图像的傅里叶变换、离散余弦变换,观察其频谱图。然后将它们进行逆变换,观察逆变换后的图像;
(1)傅里叶变换:
代码:
F=fft2(graycs);?
subplot(1,2,1);?
subimage(graycs);?
subplot(1,2,2);?
subimage(log(abs(F)),[3,10]);
效果:
(2)傅里叶反变换:
代码:
IF=ifft2(F);?
subplot(1,2,1);?
subimage(log(abs(F)),[3,10]);?
subplot(1,2,2);?
subimage(uint8(IF));?
效果:
(3)DCT变换:
代码:
B=dct2(graycs);?
subplot(1,2,1);?
subimage(graycs);?
subplot(1,2,2);?
subimage(log(abs(B)),[3,5]);
效果:
(4)iDCT变换?
代码:?
iB=idct2(B);?
subplot(1,2,1);?
subimage(log(abs(B)),[3,5]);
?subplot(1,2,2);?
subimage(uint8(iB));
效果:
3.应用MATLAB语言编程来实现一幅图像的增强。
(1)取一幅灰度图像,对其进行线性点运算,即
取(α,β)分别为(1.5,1.2)、(0.7,1.2),对原图像进行线性处理,观察处理后的结果,并分析直方图的变化。
代码:graycs=double(graycs)
显示全部