关于图像处理的一些简单的matlab编码

关于图像处理的一些简单的matlab编码

ID:34742579

大小:55.37 KB

页数:6页

时间:2019-03-10

关于图像处理的一些简单的matlab编码_第1页
关于图像处理的一些简单的matlab编码_第2页
关于图像处理的一些简单的matlab编码_第3页
关于图像处理的一些简单的matlab编码_第4页
关于图像处理的一些简单的matlab编码_第5页
资源描述:

《关于图像处理的一些简单的matlab编码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、1、关于细胞数组类型:student{1,1}={'liming','wangyi'};student{1,2}={'1','2'};student{2,1}={'f','m'};student{2,2}={20,22}student={1x2cell}{1x2cell}{1x2cell}{1x2cell}>>student{1,1}ans='liming''wangyi'>>cellplot(student)2、For循环语句closeall;clearall;k=5;hilbert=zeros(k,k);form=1:kforn=1:khilbert(m,n)=1/(m+n-1)

2、;endendformatrat3、pause函数clearall;t=0:pi/20:2*pi;x=sin(t);figure;plot(t,x);xlabel('t');ylabel('x');holdon;fori=1:7;pause;plot(t,sin(t+i/5));holdon;end4、利用error显示出错信息clearallwhile1;x=input('请输入正数:');ifx<=0;error('你输入的数是:%d,不是正数!',x);endend5、plot函数的图像>>x=0:0.01:10;>>y1=sin(2*x);>>y2=2*sin(x);>>pl

3、ot(x,y1,'b-',x,y2,'r*');>>axis([0pi-11]);>>axis([0pi-22]);>>title('正弦函数');>>xlabel('时间/单位:秒');>>ylabel('电压/单位:伏特');>>gtext('y=sin(2x)');>>gtext('y=2sin(x)');>>gridon6、将索引图像为RGB图像[X,map]=imread('spine.tif');figure;subplot(121);imshow(X,hot(64));rgb=ind2rgb(X,map);subplot(122);imshow(rgb);7、将矩阵转换

4、为灰度图像>>I=[123;456;010];>>X=mat2gray(I);>>figure;>>imshow(X)8、RGB图像转换为索引图像>>r=imread('football.jpg');>>[x1,map]=rgb2ind(r,64);>>[x2,map]=rgb2ind(r,0.2);>>map3=colorcube(128);>>x3=rgb2ind(r,map3);>>figure;>>subplot(141),imshow(r);>>subplot(142),imshow(x1,map);>>subplot(143),imshow(x2,map);>>subpl

5、ot(144),imshow(x3);9、索引图像转换为灰度图像>>[X,map]=imread('forest.tif');>>I=ind2gray(X,map);>>figure;imshow(X,map);>>figure;imshow(I);10、图像的保存loadtrees;%将文件trees载入到工作空间中whos%显示工作空间中的变量imwrite(X,map,’trees.bmp’)11、图像信息工具的显示>>h=imshow('hestain.png');>>hp=impixelinfo;>>set(hp,'position',[15029030020]);12、i

6、madjust函数closeall;clearall;clc;gamma=0.5;I=imread('peppers.png');R=I;R(:,:,2)=0;R(:,:,3)=0;R1=imadjust(R,[0.50.8],[0,1],gamma);G=I;G(:,:,1)=0;G(:,:,3)=0;G1=imadjust(G,[00.3],[01],gamma);B=IB(:,:,1)=0;B(:,:,2)=0;B1=imadjust(B,[00.3],[01],gamma);I1=R1+G1+B1;set(0,'defaultfigureposition',[100,100,

7、1000,500]);set(0,'defaultfigurecolor',[1,1,1]);figure(1);subplot(121),imshow(R);subplot(122),imshow(R1);figure(2);subplot(121),imshow(G);subplot(122),imshow(G1);figure(3);subplot(121),imshow(B);subplot(122),imshow(B1);figure(4);su

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。