数字图像处理 第二章课件.ppt
《数字图像处理 第二章课件.ppt》由会员分享,可在线阅读,更多相关《数字图像处理 第二章课件.ppt(45页珍藏版)》请在三一办公上搜索。
1、chart 02Fundamentals,2.1 Digital Image Representation 数学图像的表示2.2 Reading Images 读图像2.3 Displaying Images 显示图像2.5 Data Classes(omitted,self-study)数据的类型(略,自学)2.6 Image Types 图像的类型2.7 Converting between Data Classes and Image Types 图像类型与数据类型之间的转换2.8 Array Indexing(omitted,self-study)数组的索引(下标)(略,自学)2.9
2、Some Important Standard Arrays(omitted)一些重要的标准数组(略)2.10 M-Function Programming(omitted,self-study)M-函数编程(略,自学),An image may be defined as a two-dimensional function,f(x,y),where x and y are spatial(plane)coordinates,and the amplitude of f at any pair of coordinates(x,y)is called the intensity or gra
3、y level of the image at that point.一幅图像被定义为一个二元(维)函数f(x,y),x和y是空间(平面)坐坐标,在坐标对(x,y)处的幅值f称为图像在该点处的亮度值或灰度等级(或灰度级)Color images are formed by a combination of individual 2-D images.For example,in the RGB color system,a color image consists of three(red,green,and blue)individual component images.颜色图像可由单个2
4、维图像组合而成。例如在RGB颜色系统中,颜色图像是由三个单色成份(即红、绿和蓝)的图像组成。For this reason,many of the techniques developed for monochrome images can be extended to color images by processing the three component images individually.据此,许多针对单色图像所开发的技术,要以扩展到彩色图像上。即通过单独对三个成份图像分别处理。,2.1 Digital Image Representation,实例说明,I=imread(235
5、3.jpg);imshow(I);I1=I;I2=I;I3=I;I1(:,:,1)=I(:,:,1);I1(:,:,2)=0;I1(:,:,3)=0;I2(:,:,2)=I(:,:,2);I2(:,:,1)=0;I2(:,:,3)=0;I3(:,:,3)=I(:,:,3);I3(:,:,1)=0;I3(:,:,2)=0;figure;imshow(I);figure;imshow(I1);figure;imshow(I2);figure;imshow(I3);,实现代码:,An image may be continuous with respect to the x-and y-coordi
6、nates,and also in amplitude.一幅图像关于x和y坐标可以是连续的(即位置上连接),幅值也可以是连续的(即亮度上是连续的)。Converting such an image to digital form requires that the coordinates,as well as the amplitude,be digitized.将上述连续图像转换成数字形式,需要将坐标x、y和幅度f数字化。Digitizing the coordinate values is called sampling;digitizing the amplitude values is
7、 called quantization.将坐标值数字化称为采样;幅值的数字化称为量化。Thus,when x,y,and the amplitude values of f are all finite,discrete quantities,we call the image a digital image.因而,当x、y和幅度f都是有限的离散的量时,我们称图像为数字图像。,2.1 Digital Image Representation,The result of sampling and quantization is a matrix of real numbers.We use t
8、wo principal ways in this book to represent digital images.采样和量化的结果将得到一个实数矩阵。在本书中我们使用两个主要方法来表示图像。Assume that an image f(x,y)is sampled so that the resulting image has M rows and N columns.We say that the image is of size MN.The values of the coordinates(x,y)are discrete quantities.设图像f(x,y)是一采样后的图像,
9、因此它有M行和N列。我们称图像的大小(或尺寸)是MN,坐标(x,y)的值是离散的量。For notational clarity and convenience,we use integer values for these discete coordinates.为表示上的清晰和方便,我们使用整数值来表示这些离散的坐标,2.1.1 Coordinate Conventions,图 采样网格(a)正方形网格;(b)正六角形网格,图2-2 采样示意图,实例说明,434348,图2-3 量化示意图(a)量化;(b)量化为8 bit,图2-4 不同采样点数对图像质量的影响(a)原始图像(256256
10、);(b)采样图像1(128128);(c)采样图像2(6464);(d)采样图像3(3232);(e)采样图像4(1616);(f)采样图像5(88),图2-5 不同量化级别对图像质量的影响(a)原始图像(256色);(b)量化图像1(64色);(c)量化图像2(32色);(d)量化图像3(16色);(e)量化图像4(4色);(f)量化图像5(2色),一般,当限定数字图像的大小时,为了得到质量较好的图像可采用如下原则:(1)对缓变的图像,应该细量化,粗采样,以避免假轮廓。(2)对细节丰富的图像,应细采样,粗量化,以避免模糊(混叠)。对于彩色图像,是按照颜色成分红(R)、绿(G)、蓝(B)分别
11、采样和量化的。若各种颜色成分均按8 bit量化,即每种颜色量级别是256,则可以处理256256256=16 777 216种颜色。,In many image processing books,the image origin is defined to be at(x,y)=(0,0).The next coordinate values along the first row of the image are(x,y)=(0,1).许多图像处理教材中,图像原点被定义为(x,y)=(0,0).即参考起始点的坐标值定义为(0,0),位置从第0行第0列位置开始计数,沿着图像第一行的下一个坐标值
12、是(x,y)=(0,1),即第0行第1列的位置。It is important to keep in mind that the notation(0,1)is used to signify the second sample along the first row.It does not mean that these are the actual values of physical coordinates when the image was sampled.需要记住的一个要点是:符号(0,1)被用于标记沿第一行的第二个采样点。当图像被采样时,(0,1)等坐标值并不代表物理坐标的真实值
13、,它代表的仅仅是采样点的相对位置。如(i,j)坐标表示第i行第j个的采样点。,2.1.1 Coordinate Conventions,实例说明,Figure 2.1(a)shows this coordinate convention.Note that x ranges from 0 to M-1,and y from 0 to N-1,in integer increments.下图显示坐标约定。注意x的范围是0到M-1,y的范围是N-1,按整数值递增,Figure 2.1(a),The coordinate convention used in the toolbox to denot
14、e arrays is different from the preceding paragraph in two minor ways.工具箱中的坐标约定和前面段落中的坐标约定,在两个小的方面上有所不同。First,instead of using(x,y),the toolbox uses the notation(r,c)to indicate rows and columns.首先工具箱使用符号(r,c)来表示行数和列数,而不是使用(x,y)The other difference is that the origin of the coordinate system is at(r,
15、c)=(1,1);另一个不同之处就是在工具箱的坐标系统中,坐标的原点是在(r,c)=(1,1),即第一行的第一个列位置上的采样点是从(1,1)开始计数,也就是说,第一行记为第1行,而不是第0行(别的教材将图像的第一行记为第0行),同样列亦如此。thus,r ranges from 1 to M,and c from 1 to N,in integer increments.This coordinate convention is shown in Fig.2.1(b)因此,r的范围从1到M,c的范围是从1到N,按整数值递增。这一坐标约定如图2.1(b)所示,Figure 2.1(b),Rep
16、resentation for a digitized image function:数字图像函数的表示,2.1.2 Image as Matrices,A digital image can be represented naturally as a MATLAB matrix:在MATLAB的IPT中,数字图像表示成一个如下的MATLAB矩阵,Images are read into the MATLAB environment using function imread,whose syntax is:使用函数imread 将图像读入到MATLAB工作环境中,其语法如下:A=imread
17、(,fmt)X,map=imread(.).=imread().=imread(.,idx)CUR or ICO A,map,alpha=imread(.)CUR or ICO.=imread(.,idx)GIF.=imread(.,frames,idx)GIF.=imread(.,BackgroundColor,BG)PNG A,map,alpha=imread(.)PNG.=imread(.,idx)TIFF.=imread(.,PixelRegion,ROWS,COLS)TIFF,2.2 Reading Images,A=imread(,fmt)reads a grayscale or
18、color image from the by the string.If the not in the current directory,or in a directory on the MATLAB path,specify the full pathname.A=imread(,fmt)从字符串参数所指定的文件中读取一幅灰度图或彩色图像。如果文件不在当前路径,也不在MATLAB的搜索路径中,则应指定文件的完整路径。The return value A is an array containing the image data.If the a grayscale image,A is
19、an M-by-N array.If the a truecolor image,A is an M-by-N-by-3 array.返回值A是是一个包含图像数据的矩阵(数组)。如果图像文件是一个灰度图,则A为一MN矩阵(数组),如果图像文件是一个真彩色图像,则A是个MN3的矩阵(注MATLAB中数组和矩阵在内存分配上没有区别,有时称数组,有时称矩阵),2.2 Reading Images,Supported formats MATLAB所支持的图像文件格式,2.2 Reading Images,For example,the command line:,2.2 Reading Images,
20、f=imread(Fig0203(a)(chest-xray).tif);,Read the image chest-xray into image array f.,When,as in the preceding command line,no path information is included in,imread reads the the current directory and,if that fails,it tries to find the the MATLAB search path.在前述的命令行中,当文件名中没有路径信息时,imread就从当前路径中读取,如果读取
21、失败,就试着从MATLAB的搜索路径中读取。The simplest way to read an image from a specified directory is to include a full or relative path to that directory in.For example:从指定路径中读取图像的最简单方法就是在文件名中指定完整路径或相对路径。例如:f=imread(E:教学数字图像处理chart02(chest-xray).tif);Function size gives the row and column dimensions of an image:函数
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数字图像处理 第二章课件 数字图像 处理 第二 课件
![提示](https://www.31ppt.com/images/bang_tan.gif)
链接地址:https://www.31ppt.com/p-2137288.html