图形图像处理(第三讲).ppt

上传人:wuy****n92 文档编号:91093661 上传时间:2023-05-21 格式:PPT 页数:32 大小:594KB
返回 下载 相关 举报
图形图像处理(第三讲).ppt_第1页
第1页 / 共32页
图形图像处理(第三讲).ppt_第2页
第2页 / 共32页
点击查看更多>>
资源描述

《图形图像处理(第三讲).ppt》由会员分享,可在线阅读,更多相关《图形图像处理(第三讲).ppt(32页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、图形图像处理信息与计算科学系 张宝雷 主要内容二、数字图像处理的数学基础 u卷积和滤波u 关联函数u 二维系统 卷积与滤波 x=1 3 2;y=1 2 3 4;conv(x,y)ans=1 5 11 17 18 8CONV Convolution and polynomial multiplication.C=CONV(A,B)convolves vectors A and B.The resulting vector is length MAX(LENGTH(A)+LENGTH(B)-1,LENGTH(A),LENGTH(B).If A and B are vectors of polyno

2、mial coefficients,convolving them is equivalent to multiplying the two polynomials.卷积卷积n C=CONV(A,B,SHAPE)returns a subsection of the convolution with sizen specified by SHAPE:n full-(default)returns the full convolution,n same-returns the central part of the convolutionn that is the same size as A.

3、n valid-returns only those parts of the convolution n that are computed without the zero-padded edges.n LENGTH(C)is MAX(LENGTH(A)-MAX(0,LENGTH(B)-1),0).n n 二维卷积二维卷积n A=1 2;3 2;n B=1 0 3;4 5 2;3 1 5;n conv2(A,B)n ans=n 1 2 3 6n 7 15 21 10n 15 30 23 14n 9 9 17 10二维卷积n CONV2 Two dimensional convolution

4、.n C=CONV2(A,B)performs the 2-D convolution of matrices A and B.n If ma,na=size(A),mb,nb=size(B),and mc,nc=size(C),thenn mc=max(ma+mb-1,ma,mb)and nc=max(na+nb-1,na,nb).n n 二维卷积n C=CONV2(H1,H2,A)convolves A first with the vector H1 along then rows and then with the vector H2 along the columns.If n1=l

5、ength(H1)n and n2=length(H2),then mc=max(ma+n1-1,ma,n1)and n nc=max(na+n2-1,na,n2).n C=CONV2(.,SHAPE)returns a subsection of the 2-Dn convolution with size specified by SHAPE:n full-(default)returns the full 2-D convolution,n same-returns the central part of the convolutionn that is the same size as

6、 A.n valid-returns only those parts of the convolutionn that are computed without the zero-padded edges.n size(C)=max(ma-max(0,mb-1),na-max(0,nb-1),0).n n See also conv,convn,filter2 and,in the signal Processingn Toolbox,xcorr2.二维卷积 1 2 3 42 1 3 2 2 4 6 83 6 9 121 2 3 4 1 5 11 17 18 8卷积的性质一致收敛问题二维卷积

7、示例二维卷积示例n a=imread(cai.jpg);n imshow(a)n aa=rgb2gray(a);n subplot(221);n imshow(a);n hold on;n subplot(222);n imshow(aa);n hold on;n B=1 0;0 1;n c=conv2(A,B);n subplot(223);n imshow(c);n hold on;n b1=0 1 0;1 0 1;0 1 0;n c=conv2(A,b1);n subplot(224);n imshow(c)二维卷积示例二维卷积示例n imshow(uint8(c);n subplot(

8、223);n imshow(aa);n hold on;n c=conv2(aa,b1);n Warning:CONV2 on values of class UINT8 is obsolete.n Use CONV2(DOUBLE(A),DOUBLE(B)or CONV2(SINGLE(A),SINGLE(B)instead.n In uint8.conv2 at 11n subplot(224);n imshow(c);n hold on;n imshow(uint8(c);线性运算n subplot(221);n imshow(uint8(c);n hold on;n subplot(2

9、22);n imshow(uint8(0.5*c);n hold on;n subplot(223);n imshow(uint8(0.25*c);n hold on;n subplot(224);n imshow(uint8(0.05*c);n hold on;线性运算直方图直方图n IMHIST Display histogram of image data.n IMHIST(I)displays a histogram for the intensity image I whose number ofn bins are specified by the image type.If I

10、is a grayscale image,IMHISTn uses 256 bins as a default value.If I is a binary image,IMHIST usesn only 2 bins.n IMHIST(I,N)displays a histogram with N bins for the intensity image In above a grayscale colorbar of length N.If I is a binary image then Nn can only be 2.直方图n IMHIST(X,MAP)displays a hist

11、ogram for the indexed image X.Thisn histogram shows the distribution of pixel values above a colorbar of then colormap MAP.The colormap must be at least as long as the largest indexn in X.The histogram has one bin for each entry in the colormap.直方图n COUNTS,X=imhist(.)returns the histogram counts in

12、COUNTS and then bin locations in X so that stem(X,COUNTS)shows the histogram.Forn indexed images,it returns the histogram counts for each colormap entry;n the length of COUNTS is the same as the length of the colormap.直方图n For intensity images,the N bins of the histogram are each half-openn interval

13、s of width A/(N-1).n n In particular,for intensity images that are not int16,the p-th bin is then half-open interval:n n A*(p-1.5)/(N-1)=x A*(p-0.5)/(N-1)n n For int16 intensity images,the p-th bin is the half-open interval:n n A*(p-1.5)/(N-1)-32768=x A*(p-0.5)/(N-1)-32768 n n The intensity value is

14、 represented by x.The scale factor A depends on then image class.A is 1 if the intensity image is double or single;A is 255 ifn the intensity image is uint8;A is 65535 if the intensity image is uint16 orn int16.直方图均衡化处理n j=histeq(aa);n suplot(131);n subplot(131);n imshow(aa);n hold on;n subplot(132)

15、;n imshow(j);n hold on;n subplot(133);n imhist(j);n hold on;均衡化处理n HISTEQ Enhance contrast using histogram equalization.n HISTEQ enhances the contrast of images by transforming the values in ann intensity image,or the values in the colormap of an indexed image,son that the histogram of the output im

16、age approximately matches a specifiedn histogram.均衡化处理n J=HISTEQ(I,HGRAM)transforms the intensity image I so that the histogramn of the output image J with length(HGRAM)bins approximately matches HGRAM.n The vector HGRAM should contain integer counts for equally spaced binsn with intensity values in

17、 the appropriate range:0,1 for images of classn double or single,0,255 for images of class uint8,0,65535 for imagesn of class uint16,and-32768,32767 for images of class int16.HISTEQn automatically scales HGRAM so that sum(HGRAM)=NUMEL(I).The histogram ofn J will better match HGRAM when length(HGRAM)

18、is much smaller than then number of discrete levels in I.均衡化处理n J=HISTEQ(I,N)transforms the intensity image I,returning in J ann intensity image with N discrete levels.A roughly equal number of pixelsn is mapped to each of the N levels in J,so that the histogram of J isn approximately flat.(The hist

19、ogram of J is flatter when N is much smallern than the number of discrete levels in I.)The default value for N is 64.n 均衡化处理n J,T=HISTEQ(I)returns the gray scale transformation that maps grayn levels in the intensity image I to gray levels in J.均衡化处理n Class Supportn-n For syntaxes that include an in

20、tensity image I as input,I can be uint8,n uint16,int16,double or single.The output image J has the same class asn I.n n For syntaxes that include an indexed image X as input,X can be uint8,n double,or single.The output colormap is always double.Also,then optional output T(the gray level transform)is always of class double.均衡化处理

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 大学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁