数字图像处理-第二章
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实例说明
实现代码:
I=imread('2353.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);
Biblioteka Baidu
Figure 2.1(a)
The coordinate convention used in the toolbox to denote arrays is different from the preceding paragraph in two minor ways.
工具箱中的坐标约定和前面段落中的坐标约定,在两个小的方面 上有所不同。
2.2 Reading Images
Images are read into the MATLAB environment using function imread , whose syntax is :
1 0 连续灰度值 灰度标度 量化值 (整数值) 灰度量化 (a) (b)
图2-3 (a) 量化; (b) 量化为8 bit
图2-4 (a)原始图像(256×256);(b)采样图像1(128×128); (c) 采样图像2(64×64); (d)采样图像3(32×32); (e)采样图像4(16×16);(f) 采样图像5(8×8)
因此,r的范围从1到M,c的范围是从1到N,按整数值递增。这一 坐标约定如图2.1(b)所示
Figure 2.1(b)
2.1.2 Image as Matrices
Representation for a digitized image function: 数字图像函数的表示
A digital image can be represented naturally as a MATLAB matrix: 在MATLAB的IPT中,数字图像表示成一个如下的MATLAB矩阵
设图像f(x,y)是一采样后的图像,因此它有M行和N列。我们称图 像的大小(或尺寸)是M×N,坐标(x,y)的值是离散的量。 For notational clarity and convenience, we use integer values for these discete coordinates.
chart 02 Fundamentals
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 Some Important Standard Arrays (omitted) 一些重要的标准数组(略) 2.10 M-Function Programming (omitted, self-study) M-函数编程(略,自学)
为表示上的清晰和方便,我们使用整数值来表示这些离散的坐标
(a)
(b)
图 采样网格 (a) 正方形网格; (b) 正六角形网格
采样列 像素 采样行 行间隔
采样间隔
图2-2 采样示意图
实例说明
434×348
Zi + 1 Zi Zi - 1
2 55 2 54 qi+ 1 qi- 1
… …
1 28 1 27
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
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 gray 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.
采样和量化的结果将得到一个实数矩阵。在本书中我们使用两个 主要方法来表示图像。
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 M×N. The values of the coordinates (x,y) are discrete quantities.
2.1 Digital Image Representation
An image may be continuous with respect to the x- and ycoordinates, 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 called quantization. 将坐标值数字化称为采样;幅值的数字化称为量化。
另一个不同之处就是在工具箱的坐标系统中,坐标的原点是在 (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)
图2-5 (a) 原始图像(256色); (b) 量化图像1(64色); (c) 量化图像2(32色); (d) 量化图像3(16色); (e) 量化图像4(4色); (f) 量化图像5(2色)
一般,当限定数字图像的大小时, 为了得到质量较好的图
(1) 对缓变的图像, 应该细量化, 粗采样, 以避免假 轮廓。 (2) 对细节丰富的图像, 应细采样, 粗量化, 以避免 模糊(混叠)。 对于彩色图像,是按照颜色成分 ——红( R)、绿( G )、 蓝(B) 。若各种颜色成分均按8 bit量化, 即每种颜色量级别是256, 则可以处理256×256×256=16 777 216种颜色。
2.1.1 Coordinate Conventions
The result of sampling and quantization is a matrix of real numbers. We use two principal ways in this book to represent digital images.
◆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,c) = (1,1);
2.1.1 Coordinate Conventions
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列位置开始计数,沿着图像第 一行的下一个坐标值是(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)等坐标值并不代表物理坐标的真实值, 它代表的仅仅是采样点的相对位置。如(i,j)坐标表示第i行第j个的采样 点。
实例说明
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,按整 数值递增
颜色图像可由单个2维图像组合而成。例如在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. 据此,许多针对单色图像所开发的技术,要以扩展到彩色图像上。 即通过单独对三个成份图像分别处理。