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

上传人:牧羊曲112 文档编号:6558691 上传时间:2023-11-12 格式:PPT 页数:32 大小:594KB
返回 下载 相关 举报
图形图像处理(第三讲).ppt_第1页
第1页 / 共32页
图形图像处理(第三讲).ppt_第2页
第2页 / 共32页
图形图像处理(第三讲).ppt_第3页
第3页 / 共32页
图形图像处理(第三讲).ppt_第4页
第4页 / 共32页
图形图像处理(第三讲).ppt_第5页
第5页 / 共32页
点击查看更多>>
资源描述

《图形图像处理(第三讲).ppt》由会员分享,可在线阅读,更多相关《图形图像处理(第三讲).ppt(32页珍藏版)》请在三一办公上搜索。

1、图形图像处理,信息与计算科学系 张宝雷,主要内容,二、数字图像处理的数学基础,卷积和滤波 关联函数 二维系统,卷积与滤波,x=1 3 2;y=1 2 3 4;conv(x,y)ans=1 5 11 17 18 8,CONV 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.,卷积,卷积,C=CONV(A,B,SHAPE)returns a subsection of the convolution with size specified by SHAPE:full-(default)returns the full convolution,same-returns the central part of the convolution that is the same size as A.valid

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

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

5、max(ma+n1-1,ma,n1)and nc=max(na+n2-1,na,n2).,C=CONV2(.,SHAPE)returns a subsection of the 2-D convolution with size specified by SHAPE:full-(default)returns the full 2-D convolution,same-returns the central part of the convolution that is the same size as A.valid-returns only those parts of the convo

6、lution that are computed without the zero-padded edges.size(C)=max(ma-max(0,mb-1),na-max(0,nb-1),0).See also conv,convn,filter2 and,in the signal Processing Toolbox,xcorr2.,二维卷积,2 3 4 1 3 2,2 4 6 8,3 6 9 12,1 2 3 4,1 5 11 17 18 8,卷积的性质,?,一致收敛,问题,二维卷积示例,二维卷积示例,a=imread(cai.jpg);imshow(a)aa=rgb2gray(a

7、);subplot(221);imshow(a);hold on;subplot(222);imshow(aa);hold on;B=1 0;0 1;c=conv2(A,B);subplot(223);imshow(c);hold on;b1=0 1 0;1 0 1;0 1 0;c=conv2(A,b1);subplot(224);imshow(c),二维卷积示例,二维卷积示例,imshow(uint8(c);subplot(223);imshow(aa);hold on;c=conv2(aa,b1);Warning:CONV2 on values of class UINT8 is obso

8、lete.Use CONV2(DOUBLE(A),DOUBLE(B)or CONV2(SINGLE(A),SINGLE(B)instead.In uint8.conv2 at 11 subplot(224);imshow(c);hold on;imshow(uint8(c);,线性运算,subplot(221);imshow(uint8(c);hold on;subplot(222);imshow(uint8(0.5*c);hold on;subplot(223);imshow(uint8(0.25*c);hold on;subplot(224);imshow(uint8(0.05*c);ho

9、ld on;,线性运算,直方图,直方图,IMHIST Display histogram of image data.IMHIST(I)displays a histogram for the intensity image I whose number of bins are specified by the image type.If I is a grayscale image,IMHIST uses 256 bins as a default value.If I is a binary image,IMHIST uses only 2 bins.,IMHIST(I,N)display

10、s a histogram with N bins for the intensity image I above a grayscale colorbar of length N.If I is a binary image then N can only be 2.,直方图,IMHIST(X,MAP)displays a histogram for the indexed image X.This histogram shows the distribution of pixel values above a colorbar of the colormap MAP.The colorma

11、p must be at least as long as the largest index in X.The histogram has one bin for each entry in the colormap.,直方图,COUNTS,X=imhist(.)returns the histogram counts in COUNTS and the bin locations in X so that stem(X,COUNTS)shows the histogram.For indexed images,it returns the histogram counts for each

12、 colormap entry;the length of COUNTS is the same as the length of the colormap.,直方图,For intensity images,the N bins of the histogram are each half-open intervals of width A/(N-1).In particular,for intensity images that are not int16,the p-th bin is the half-open interval:A*(p-1.5)/(N-1)=x A*(p-0.5)/

13、(N-1)For int16 intensity images,the p-th bin is the half-open interval:A*(p-1.5)/(N-1)-32768=x A*(p-0.5)/(N-1)-32768 The intensity value is represented by x.The scale factor A depends on the image class.A is 1 if the intensity image is double or single;A is 255 if the intensity image is uint8;A is 6

14、5535 if the intensity image is uint16 or int16.,直方图,均衡化处理,j=histeq(aa);suplot(131);subplot(131);imshow(aa);hold on;subplot(132);imshow(j);hold on;subplot(133);imhist(j);hold on;,均衡化处理,HISTEQ Enhance contrast using histogram equalization.HISTEQ enhances the contrast of images by transforming the valu

15、es in an intensity image,or the values in the colormap of an indexed image,so that the histogram of the output image approximately matches a specified histogram.,均衡化处理,J=HISTEQ(I,HGRAM)transforms the intensity image I so that the histogram of the output image J with length(HGRAM)bins approximately m

16、atches HGRAM.The vector HGRAM should contain integer counts for equally spaced bins with intensity values in the appropriate range:0,1 for images of class double or single,0,255 for images of class uint8,0,65535 for images of class uint16,and-32768,32767 for images of class int16.HISTEQ automaticall

17、y scales HGRAM so that sum(HGRAM)=NUMEL(I).The histogram of J will better match HGRAM when length(HGRAM)is much smaller than the number of discrete levels in I.,均衡化处理,J=HISTEQ(I,N)transforms the intensity image I,returning in J an intensity image with N discrete levels.A roughly equal number of pixe

18、ls is mapped to each of the N levels in J,so that the histogram of J is approximately flat.(The histogram of J is flatter when N is much smaller than the number of discrete levels in I.)The default value for N is 64.,均衡化处理,J,T=HISTEQ(I)returns the gray scale transformation that maps gray levels in t

19、he intensity image I to gray levels in J.,均衡化处理,Class Support-For syntaxes that include an intensity image I as input,I can be uint8,uint16,int16,double or single.The output image J has the same class as I.For syntaxes that include an indexed image X as input,X can be uint8,double,or single.The output colormap is always double.Also,the optional output T(the gray level transform)is always of class double.,均衡化处理,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号