Chapter 2: Digital Image Fundamentals Image sampling and quantization Digital image representation Some basic relationships between pixels Linear and nonlinear operation
2.1 Image sampling and quantization 采 样 子 系 统 成像系统 量 化 器 景物 采样图像 数字图像 图像 图2.1 图像采集系统
2.1 Image sampling and quantization digitizing image is to convert a continuous image to digital form. this involves two processes: sampling and quantization
Image sampling 采样定理 冲激串采样 采样函数 采样周期 T 采样频率
Image sampling 是频域上的周期函数,它满足 是由一组移位的 叠加而成,但在幅度上有1/T的变化
Image sampling 采样定理 冲激串采样的频谱
Image sampling 采样定理 冲激串采样的频谱
Image sampling 图像采样 空间采样函数 空间采样函数 空间采样频率
Image sampling 图像采样 空间采样函数
Image sampling 图像采样 采样后图像
Image sampling 图像采样 采样图像频谱
Image sampling digitizing the coordinate is called sampling sampling space is equal along direction of x- and y-coordinate if sampling space is too small, data capacity is too large, otherwise , information may be overlap, so that detail information can not identified. sampling index
Sampling example 细节清晰,数据量为100% 细节无法辨认,数据量为1%
Sampling resolution Spatial resolution (1) the most smallest number of pixel per unit distance. unit:pixel/inch,pixel/cm (2) a image involves the most smallest number of pixel . unit:pixel × pixel
quantization Digitizing the amplitude is called quantization Equal quantization and un-equal quantization Quantization space is too small, otherwise, it may be aliasing and pattern sampling index Gray-level resolution it is the number of gray level of a pixel, which is usually an integer power of 2.the most common number is 8 bit or 16 bit.
aliasing and pattern
2.2 Digital image representation coordinate conventions image as matrices three type of image BITMAP representation reading images displaying images
coordinate conventions
image as matrices
three type of image (1) Binary image Binary image Gray image Color image (1) Binary image Binary image
(2) Gray image (3) Color image A quantity gray is used for image representation, and no color information (3) Color image color image RGB 3 matrix
File structure 数据区 RGBQUAD 像素的RGB值 像素的调色板索引值 真彩色模式 索引色模式 file-head bITMAPFILEHEADER information-head BITMAPINFOHEADER 数据区 file-head BITMAPFILEHEADER information-head BITMAPINFOHEADER color palette RGBQUAD 数据区 像素的RGB值 像素的调色板索引值 真彩色模式 索引色模式
file-head BITMAPFILEHEADER bfType 文件类型标识“BM” bfSize 文件总字节数 bfReserved1 保留字“0” bfReserved2 保留字“0”
information-head BITMAPINFOHEADER biSize 信息头结构体长度,为40 biWidth 图像宽度,单位是像素 biHeight 图像高度,单位是像素 biPlanes 必须为1,暂无意义 biCompression 指定位图是否压缩 biSizeImage 实际位图数据所占字节数 biXperlsPerMeter 指定目标设备的水平分辨率 biYperlsPerMeter 指定目标设备的垂直分辨率 biClrImportant 图像中重要的颜色数
真彩色模式的数据区结构 像素的RGB值 真彩色数据区 :
索引色模式的调色板 调色板 RGBQUAD 索引值 R G B 1 R1 G1 B1 2 R2 G2 B2 : : N RN GN BN
索引色模式的数据区 数据区 像素的调色板索引值 索引值 R G B 1 R1 G1 B1 2 R2 G2 B2 : : N RN GN BN
reading images Syntax : imread( ‘filename’ ) 包含图像文件全名的字符串 Syntax : imread( ‘filename’ ) >>f=imread(‘chestxray.jpg’); >>size(f); ans= 1024 1024
displaying images Syntax : imshow( f,G) or imshow(f,[low high]) 显示该图像的灰度级数 Syntax : imshow( f,G) or imshow(f,[low high]) 图像数组 >>f=imread(‘chestxray.jpg’); >>size(f); >>imshow(f,256); >>imshow(f,[150 237]);
2.3 Some basic relationships between pixels neighbors of a pixel adjacency, connectivity, region, and boundaries distance measure Linear and nonlinear operation
neighbors of a pixel 1. 4-neighbors of a pixel p at coordinates (x, y) Their coordinates is respectively (x+1, y), (x-1, y), (x , y+1), (x ,y-1). N4(p) 2. 4 diagonal-neighbors of a pixel p at (x, y) Their coordinates is respectively (x+1, y+1), (x+1, y-1), (x-1 , y+1), (x-1 ,y-1). ND(p)
neighbors of a pixel 3. 8-neighbors of a pixel p at (x, y) Their coordinates is respectively (x+1, y), (x-1, y), (x , y+1), (x ,y-1), (x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1) . N8(p)
1. adjacency adjacency, connectivity, region, and boundaries 消除采用8-邻接产生的二义性。 (1) 4 - adjacency: if q is in the set N4(p). (2) 8 - adjacency: if q is in the set N8(p). (3)m - adjacency: if q is in N4(p) or q is in ND(p) and N4(p) ∩N4(q) has no pixels whose values are from V. 0 1 1 0 1 0 0 0 1 (a) (b) (c) Adjacency of a pixel
3. connectivity ( p q in set S) adjacency, connectivity, region, and boundaries 2. path( p(x, y) q(s, t) ) A sequence of distinct pixels with coordinates: ( x0 , y0 ) , ( x1, y1 ) , … , (xn , yn) If ( x0 , y0 ) = (xn , yn) ,the path is a closed path. 3. connectivity ( p q in set S) If there exists a path between them consisting entirely of pixels in S. a connected component of S is the set of pixels that are connected to a pixel in S. if it only has one connected component ,then S is a connected set.
adjacency, connectivity, region, and boundaries if R is connected set, R is called a region of the image. 5. boundaries the boundary of a region R is the set of pixels in the region that have one or more neighbors that are not in R.
Distance measure 1. A distance function or metric For p(x,y), q(s,t),z(v,w), if (a) D(p,q)≥0 ( D(p,q) = 0 iff p=q ) (b) D(p,q) = D(q, p) (c) D(p,z) ≤ D(p,q) + D(q, z) 2. Euclidean distance
Distance measure 3. D4 distance city block distance 4. D8 distance chessboard distance 2 2 1 2 2 1 0 1 2 D4(p,q)≤2 2 2 2 2 2 2 1 1 1 2 2 1 0 1 2 D8(p,q)≤2
Linear and nonlinear operation