资源预览内容
第1页 / 共18页
第2页 / 共18页
第3页 / 共18页
第4页 / 共18页
第5页 / 共18页
第6页 / 共18页
第7页 / 共18页
第8页 / 共18页
第9页 / 共18页
第10页 / 共18页
亲,该文档总共18页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
图像处理实验1234实验一 Matlab基本运算1、 按水平和竖直方向分别合并下述两个矩阵: A=1 0 0;1 1 0;0 0 1A = 1 0 0 1 1 0 0 0 1 B=2 3 4;5 6 7;8 9 10B = 2 3 4 5 6 7 8 9 10 C=A BC = 1 0 0 2 3 4 1 1 0 5 6 7 0 0 1 8 9 10 D=A;BD = 1 0 0 1 1 0 0 0 1 2 3 4 5 6 7 8 9 10(1) 分别删除上述两个结果的第2行。 C(2,:)=C = 1 0 0 2 3 4 0 0 1 8 9 10 D(2,:)=D = 1 0 0 0 0 1 2 3 4 5 6 7 8 9 10(2)分别将上述两个结果的第2行最后3列的数值 改为11 12 13。 C(2,4:6)=11 12 13C = 1 0 0 2 3 4 0 0 1 11 12 13 D(2,:)=11 12 13D = 1 0 0 11 12 13 2 3 4 5 6 7 8 9 10(3) 分别查看上述两个结果的各方向长度。 C_SIZE=size(C)C_SIZE = 2 6 D_SIZE=size(D)D_SIZE = 5 3(4) 分别计算上述矩阵A和B的A+B、A.* B、A./B和 AB,分析结果。 AB1=A+BAB1 = 3 3 4 6 7 7 8 9 11 AB2=A.*BAB2 = 2 0 0 5 6 0 0 0 10 AB3=A./BAB3 = 0.5000 0 0 0.2000 0.1667 0 0 0 0.1000 AB4=ABAB4 = 2 3 4 3 3 3 8 9 10(5) 计算矩阵A和B的A&B 、 A|B、 A和B,分析结果。 AB5=A&BAB5 = 1 0 0 1 1 0 0 0 1 AB6=A|BAB6 = 1 1 1 1 1 1 1 1 1 AB7=BAB7 = 0 0 0 0 0 0 0 0 0 AB8=AAB8 = 0 1 1 0 0 1 1 1 0(6) 判断上述矩阵A和B中哪些元素值不小于4。 A.*(A=4)ans = 0 0 0 0 0 0 0 0 0 B.*(B=4)ans = 0 0 4 5 6 7 8 9 102、下面是Matlab中有关图像读出、显示和保存函数使用的一段代码:f = imread ( filename); M, N = size( f ); imshow ( f );imwrite (f, filename.jpg) f=imread(filename.jpg); M,N=size(f); imshow(f);Warning: Image is too big to fit on screen; displaying at 56% scale. In truesizeResize1 at 308 In truesize at 44 In imshow at 161 imwrite(f,filename.jpg)各函数的详细使用方法,请各位查看Matlab中的帮助,使用“help 函数名”即可以查看函数的使用方法。请完成以下内容:(1) 读取文件夹中的图像“pollen.tif.tif”,用imshow(f)和imshow(f, )显示,并将后一幅图存为”pollen1.tif”。思考:为什么图像变清楚了? f=imread(bubbles.tif); imshow(f);Warning: Image is too big to fit on screen; displaying at 75% scale. In truesizeResize1 at 308 In truesize at 44 In imshow at 161 figure,imshow(f,);Warning: Image is too big to fit on screen; displaying at 75% scale. In truesizeResize1 at 308 In truesize at 44 In imshow at 161(2) 用不同的压缩参数(80,50,10)将bubbles.tif 保存为jpeg图像,比较压缩参数的作用, 并通过imfinfo获取文件信息了解图像的压缩情况对图像质量的影响 imwrite(f,bubbles1.jpg,quality,80); g=imread(bubbles1.jpg); imshow(g);Warning: Image is too big to fit on screen; displaying at 75% scale. In truesizeResize1 at 308 In truesize at 44 In imshow at 161 imwrite(f,bubbles2.jpg,quality,50); g1=imread(bubbles2.jpg); figure,imshow(g1);Warning: Image is too big to fit on screen; displaying at 75% scale. In truesizeResize1 at 308 In truesize at 44 In imshow at 161 imwrite(f,bubbles3.jpg,quality,10); g2=imread(bubbles3.jpg); figure,imshow(g2);Warning: Image is too big to fit on screen; displaying at 75% scale. In truesizeResize1 at 308 In truesize at 44 In imshow at 161 imfinfo(bubbles1.jpg)ans = Filename: bubbles1.jpg FileModDate: 26-Sep-2014 00:01:44 FileSize: 39129 Format: jpg FormatVersion: Width: 720 Height: 688 BitDepth: 8 ColorType: grayscale FormatSignature: NumberOfSamples: 1 CodingMethod: Huffman CodingProcess: Sequential Comment: imfinfo(bubbles2.jpg)ans = Filename: bubbles2.jpg FileModDate: 26-Sep-2014 00:02:46 FileSize: 20068 Format: jpg FormatVersion: Width: 720 Height: 688 BitDepth: 8 ColorType: grayscale FormatSignature: NumberOfSamples: 1 CodingMethod: Huffman CodingProcess: Sequential Comment: imfinfo(bubbles3.jpg)ans = Filename: bubbles3.jpg FileModDate: 26-Sep-2014 00:03:29 FileSize: 9498 Format: jpg FormatVersion: Width: 720 Height: 688 BitDepth: 8 ColorType: grayscale FormatSignature: NumberOfSamples: 1
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号