圖形圖像 intro of Image入門_第1頁
圖形圖像 intro of Image入門_第2頁
圖形圖像 intro of Image入門_第3頁
圖形圖像 intro of Image入門_第4頁
圖形圖像 intro of Image入門_第5頁
已閱讀5頁,還剩94頁未讀, 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、 Introduction of image processingUniversity of Science and Technology of Beijing沈政偉 1, Digital Image and Properties 2, Digital Image Preprocessing 3, Image Smoothing 4 PDE and Image Smoothing 5, Image Sharpening 6, Fourier Transformation 7,Image Coding 1,Totally 32 lessons, 12 practices lessons, 20

2、lectures lesson. 2, Reference: , Rafael C. Gonzalez & Richard E. Woods. Publishing House of Electronics Industry. Application of digital image processing Original image with salt and pepper noiseMedian filtered image (3x3) original Segmentation original Segmentation compressing Original imageIma

3、ge after NOT operationwatermarkingoriginal image5010015020025050100150200250watermark image204060204060chaos watermark image204060204060watermarked Lenna image50100 150 200 25050100150200250壓縮攻擊后提出的水印 compress attack102030405060102030405060Image fusionInpaintingG.Sapiro, Geometric Partial Differenti

4、al Equations and Image Analysis, Cambridge, Univ. Press, 2001.N.Paragios & R.DericheGeodesic actice contours and level sets for detection and tracking of moving objects, IEEE Trans. Patten Anal. Mach. Intell. 22, (2000), 266-280.Tracking for moving objectsDebluring: Blured ImageDehaze 1, What is

5、 image? The continuous image can be modeled by a continuous function of two or three variables f=f( x, y) (2D), f=f( x, y, z) (3D) The image function values f correspond to the brightness at image points. When an image is generated from a physical process, its values are proportional to energy radia

6、ted by a physical source (e.g. electromagnetic waves). As a consequence, f(x,y) must be nonzero and energy finite, that is 20( , )f x yR(x,y) We call the intensity of a monochrome image at any coordinates the grey level (gl) of the images at that point, That is And we have Common practice is to shif

7、t this interval numerically to the interval Where gl=0 is considered black, and gl=L-1 is considered white on the grey scale. All intermediate values are shades of grey varying from black to white.),(00yx00( ,)glf x yminmaxLglL01glL 2, what is digital image? How to convert the continuous image ( con

8、tinuous with respect to the x and y coordinates and also in amplitude ) to digital image? We all know that the output of most sensors is a continuous voltage waveform whose amplitude and spatial behavior are related to the physical phenomenon being sensed. sampling quantization Digitizing the coordi

9、nate values is called sampling. Digitizing the amplitude values is called quantization. What is sampling? A continuous image function f( x, y ) can be sampled using a discrete grid of sampling points in the plane. The image is sampled at points , for j=1,.M, k=1.N. The neighboring sampling points ar

10、e separated by distance along the x axis and Along the y axis. Distances and are called the sampling interval( on the x or y axis), and the matrix of samples constitutes the discrete image. What is quantization? A value of the sampled image is expressed as digital value in image processing. The tran

11、sition between continuous values of the image function( brightness) and its digital equivalent is called*xjx*ykyxyxy( *,*)fjx ky( *,*)fjx ky quantization. The number of quantization levels should be high enough to permit human perception of fine shading details in the image. Most digital image proce

12、ssing devices use quantization into k equal intervals. If b bits are used to express the values of the pixel brightness, then the number of brightness levels is k=2b. 8 bits per pixel are commonly used, although some systems use six or four bits. A binary image pixel, which is either black or white,

13、 can be represented by one bit. Specialized measuring devices us 12 and more bits per pixel, although these are becoming more common. The result of sampling and quantization of continuous image is a matrix of real numbers. Spatial resolution is MxN pixels. Gray-level resolution is Each element of th

14、is matrix array is called an image element, picture element, pixel. For digital images the minimum gray level is usually 0, but the maximum depends on number of quantization levels used to digitize an image. The most common is 256 levels, so that the maximum level is 255. ) 1, 1() 1 , 1() 0 , 1() 1,

15、 1 () 1 , 1 () 0 , 1 () 1, 0 () 1 , 0 () 0 , 0 (),(NMfMfMfNfffNfffyxf2K64 60 69 100 149 151 176 182 17965 62 68 97 145 148 175 183 18165 66 70 95 142 146 176 185 18466 66 68 90 135 140 172 184 18466 64 64 84 129 134 168 181 18259 63 62 88 130 128 166 185 18060 62 60 85 127 125 163 183 17862 62 58 81

16、 122 120 160 181 17663 64 58 78 118 117 159 180 176210 209 204 202 197 247 143 71 64 80 84 54 54 57 58 206 196 203 197 195 210 207 56 63 58 53 53 61 62 51 201 207 192 201 198 213 156 69 65 57 55 52 53 60 50 216 206 211 193 202 207 208 57 69 60 55 77 49 62 61 221 206 211 194 196 197 220 56 63 60 55 4

17、6 97 58 106 209 214 224 199 194 193 204 173 64 60 59 51 62 56 48 204 212 213 208 191 190 191 214 60 62 66 76 51 49 55 214 215 215 207 208 180 172 188 69 72 55 49 56 52 56 209 205 214 205 204 196 187 196 86 62 66 87 57 60 48 208 209 205 203 202 186 174 185 149 71 63 55 55 45 56 207 210 211 199 217 19

18、4 183 177 209 90 62 64 52 93 52 208 205 209 209 197 194 183 187 187 239 58 68 61 51 56 204 206 203 209 195 203 188 185 183 221 75 61 58 60 60 200 203 199 236 188 197 183 190 183 196 122 63 58 64 66 205 210 202 203 199 197 196 181 173 186 105 62 57 64 63 x = 58 59 60 61 62 63 64 65 66 67 68 69 70 71

19、72414243444546474849505152535455Grayscale Imagey = bits per pixels 1 bit per pixel21 = 2 colorsBinary images8 bits per pixel28 = 256 colorsGray scale images24 bits per pixel224 colorsColor images2 gray levels(1 bit/pixel)BINARY IMAGE4 gray levels(2 bits/pixel)8 gray levels(3 bits/pixel)16 gray level

20、s(4 bits/pixel)256 gray levels(8 bits/pixel)Effects of reducing number of gray levels Original 8-bit image,256 gray levelsQuantized to 6 bits ,64 gray levelsQuantized to 3 bits ,8 gray levelsQuantized to 1 bits ,2 gray levels Spatial and Gray-Level ResolutionSpatial ResolutionEffects of down-samplin

21、g (reducing number of pixels)4 x 416 x 1664 x 648 x 832 x 32128 x 128 Spatial Resolution by Re-sampling Gray-Level Resolution248161283264256 How to Decide Spatial and Gray-Level Resolution?Figure 2.22 (a): The womans face; Image with low level of detail.Figure 2.22 (b): The cameraman; Image with med

22、ium level of detail.Figure 2.22 (c): The crowd picture; Image with a relatively large amount of detail.More edgesMore edgesMore TexturesMore TexturesMore TexturesMore TexturesMore DetailsMore detailsMore details Color of image Raster images can be divided into black and white grey scale color image(

23、 chromatic ) black and white Grey scale images should accommodate over 200 different tones of grey . Images will not look continuous with less than 200 tones of grey. 灰度圖象以每象素八個比特信息表示,并且一幅灰度圖象的信息以一種不同的方式進行組織以適應增強色彩性能?;叶葓D象方式提供2的8次方256種表達圖像細節的亮度值。一副灰度圖象中的信息組織成一個單色信道。 Color model 為了用計算機來表示和處理顏色,必須采用定量的

24、方法來為了用計算機來表示和處理顏色,必須采用定量的方法來描述顏色,即建立顏色模型。目前廣泛使用的顏色模型有描述顏色,即建立顏色模型。目前廣泛使用的顏色模型有三類:計算顏色模型、工業顏色模型、視覺顏色模型。計三類:計算顏色模型、工業顏色模型、視覺顏色模型。計算顏色模型又稱為色度學顏色模型,主要應用于純理論研算顏色模型又稱為色度學顏色模型,主要應用于純理論研究和計算推導;工業顏色模型側重于實際應用的實現技術;究和計算推導;工業顏色模型側重于實際應用的實現技術;視覺顏色模型用于與人直接接口的顏色模型和控制。視覺顏色模型用于與人直接接口的顏色模型和控制。 計算顏色模型有計算顏色模型有CIE的的RGB、

25、XYZ、Luv、LCH、LAB、UCS、UVW。 工業顏色模型工業顏色模型NTSC的的RGB、YUV、YIQ、CMYK、YCbCr。 視覺顏色模型有視覺顏色模型有HS*系列,包含系列,包含HSL、HSV(B)。 Color models A color model is an abstract mathematical model describing the way colors can be represented as types of numbers, typically as three or four values or color components. When this mo

26、del is associated with a precise description of how the components are to be interpreted (viewing conditions, etc.), the resulting set of colors is called a color space. RGB CIE(國際照明委員會)顏色模型),XYZ, YUV CMY (Cyan(青色), Magenta(紅紫色), Yellow) HSI (Hue(色調), Saturation(飽和度), Intensity(亮度) Others HSI顏色空間 HS

27、I色彩空間是從人的視覺系統出發,用色調(Hue)、色飽和度(Saturation或Chroma)和亮度 (Intensity或Brightness)來描述色彩。HSI色彩空間可以用一個圓錐空間模型來描述。用這種 描述HIS色彩空間的圓錐模型相當復雜,但確能把色調、亮度和色飽和度的變化情形表現得很清楚。 通常把色調和飽和度通稱為色度,用來表示顏色的類別與深淺程度。由于人的視覺對亮度的敏感 程度遠強于對顏色濃淡的敏感程度,為了便于色彩處理和識別,人的視覺系統經常采用HSI色彩空間, 它比RGB色彩空間更符合人的視覺特性。在圖像處理和計算機視覺中大量算法都可在HSI色彩空間中 方便地使用,它們可以分

28、開處理而且是相互獨立的。因此,在HSI色彩空間可以大大簡化圖像分析 和處理的工作量。HSI色彩空間和RGB色彩空間只是同一物理量的不同表示法,因而它們之間存在著 轉換關系。 YUV顏色空間 在現代彩色電視系統中,通常采用三管彩色攝像機或彩色CCD(點耦合器件)攝像機,它把攝得的彩色圖像 信號,經分色、分別放大校正得到RGB,再經過矩陣變換電路得到亮度信號Y和兩個色差信號RY、BY, 最后發送端將亮度和色差三個信號分別進行編碼,用同一信道發送出去。這就是我們常用的YUV色彩空間。 采用YUV色彩空間的重要性是它的亮度信號Y和色度信號U、V是分離的。如果只有Y信號分量而沒有U、V分量, 那么這樣表

29、示的圖就是黑白灰度圖。彩色電視采用YUV空間正是為了用亮度信號Y解決彩色電視機與黑白電視機 的兼容問題,使黑白電視機也能接收彩色信號。根據美國國家電視制式委員會,NTSC制式的標準,當白光的 亮度用Y來表示時,它和紅、綠、藍三色光的關系可用如下式的方程描述:Y=0.3R+0.59G+0.11B 這就是常用 的亮度公式。色差U、V是由BY、RY按不同比例壓縮而成的。如果要由YUV空間轉化成RGB空間,只要進行 相反的逆運算即可。與YUV色彩空間類似的還有Lab色彩空間,它也是用亮度和色差來描述色彩分量,其中L為 亮度、a和b分別為各色差分量。 XYZ顏色空間 國際照明委員會(CIE)在進行了大量

30、正常人視覺測量和統計,1931年建立了“標準色度觀察者”, 從而奠定了現代CIE標準色度學的定量基礎。由于“標準色度觀察者”用來標定光譜色時出現負 刺激值,計算不便,也不易理解,因此1931年CIE在RGB系統基礎上,改用三個假想的原色X、Y、 Z建立了一個新的色度系統。將它匹配能得到光譜的三刺激值,定名為“CIE1931 標準色度觀察者 光譜三刺激值”,簡稱為“CIE1931標準色度觀察者”。這一系統叫做“CIE1931標準色度系統”。視場XYZ色度系統。CIEXYZ顏色空間稍加變換就可得到Yxy色彩空間,其中Y取三刺激值中Y的值, 表示亮度,x、y反映顏色的色度特性。定義如下:在色彩管理中

31、,選擇與設備無關的顏色空間是 十分重要的,與設備無關的顏色空間由國際照明委員會(CIE)制定,包括CIEXYZ和CIELAB兩個標準。 它們包含了人眼所能辨別的全部顏色。而且,CIEYxy測色制的建立給定量的確定顏色創造了條件。 但是,在這一空間中,兩種不同顏色之間的距離值并不能正確地反映人們色彩感覺差別的大小, 也就是說在CIEYxy色廈圖中,在 不同的位置不同方向上顏色的寬容量是不同的,這就是Yxy顏色空間 的不均勻性。這一缺陷的存在,使得在Yxy及XYZ空間不能直觀地評價顏色。 Cyan(青色), Magenta(洋紅色), and Yellow (CMY) are complement

32、ary colors of RGB. They can be used as Subtractive Primaries. CMY model is mostly used in printing devices where the color pigments on the paper absorb certain colors (e.g., no red light reflected from cyan ink).各個模型之間可以相互轉換 |X| | 0.607 0.174 0.201| |R| |Y| = | 0.299 0.587 0.114| * |G| |Z| | 0.000 0

33、.066 1.117| |B| |R| | 1.910 -0.532 -0.288| |X| |G| = |-0.985 1.999 -0.028| * |Y| |B| | 0.058 -0.118 0.898| |Z| RGB顏色空間 RGB(red,green,blue)顏色空間最常用的用途就是顯示器系統,彩色陰極射線管,彩色光柵圖形的顯示器 都使用R、G、B數值來驅動R、G、B 電子槍發射電子,并分別激發熒光屏上的R、G、B三種顏色的熒光粉 發出不同亮度的光線,并通過相加混合產生各種顏色;掃描儀也是通過吸收原稿經反射或透射而發送來 的光線中的R、G、B成分,并用它來表示原稿的顏色。RGB

34、色彩空間稱為與設備相關的色彩空間,因為不同 的掃描儀掃描同一幅圖像,會得到不同色彩的圖像數據;不同型號的顯示器顯示同一幅圖像,也會有不同 的色彩顯示結果。HSV顏色空間 HSV(hue,saturation,value)顏色空間的模型對應于圓柱坐標系中的一個圓錐形子集,圓錐的頂面對應于V=1. 它包含RGB模型中的R=1,G=1,B=1 三個面,所代表的顏色較亮。色彩H由繞V軸的旋轉角給定。紅色對應于 角度0 ,綠色對應于角度120,藍色對應于角度240。在HSV顏色模型中,每一種顏色和它的補色相差180 。 飽和度S取值從0到1,所以圓錐頂面的半徑為。HSV顏色模型所代表的顏色域是CIE色度

35、圖的一個子集,這個 模型中飽和度為百分之百的顏色,其純度一般小于百分之百。在圓錐的頂點(即原點)處,V=0,H和S無定義, 代表黑色。圓錐的頂面中心處S=0,V=1,H無定義,代表白色。從該點到原點代表亮度漸暗的灰色,即具有不同 灰度的灰色。對于這些點,S=0,H的值無定義??梢哉f,HSV模型中的V軸對應于RGB顏色空間中的主對角線。 在圓錐頂面的圓周上的顏色,V=1,S=1,這種顏色是純色。HSV模型對應于畫家配色的方法。畫家用改變色濃和 色深的方法從某種純色獲得不同色調的顏色,在一種純色中加入白色以改變色濃,加入黑色以改變色深,同時 加入不同比例的白色,黑色即可獲得各種不同的色調。 RGB

36、 models refer to red, green, blue. Thus a particular pixel may have associated with it a three-dimensional vector (r,g,b) which provides the respective color intensities.Color ImageRGB 與HIS的轉換 RGB到到HSI轉換:轉換: RGB 向向HSI 模型的轉換是由一個基于笛卡爾模型的轉換是由一個基于笛卡爾直角坐標系的單位立方體向基于圓柱極坐標直角坐標系的單位立方體向基于圓柱極坐標的雙錐體的轉換?;疽笫菍⒌碾p

37、錐體的轉換?;疽笫菍GB 中的亮中的亮度因素分離,將色度分解為色調和飽和度,度因素分離,將色度分解為色調和飽和度,并用角向量表示色調,如圖并用角向量表示色調,如圖2所示。所示。 有一個長寬各為200個象素,顏色數為16色的彩色圖,每一個象素都用R,G,B三個分量表示,因為每個分量有256個級別,要用8位(bit),即一個字節(byte)來表示,所以每個象素需要用3個字節。 問題:要用多少個字節表示? 因為是一個16色圖,也就是說這幅圖中最多只有16種顏色,我們可以用一個表:表中的每一行記錄一種顏色的R,G,B值。這樣當我們表示一個象素的顏色時,只需要指出該顏色是在第幾行,即該顏色在表中的

38、索引值。舉個例子,如果表的第0行為255,0,0(紅色),那么當某個象素為紅色時,只需要標明0即可。 問題:如果用這種方法,需要多少個字節來存儲這個16色位圖? Homework (1) what is color models? (2) what is the transform between RGB and HSI? Tell us the formulation and Matlab program is good work. (3) what is the transform between RGB and XYZ? Format of image Image file format

39、s are standardized means of organizing and storing images There are two types of digital image Vector image formats store images as a set of individual object. object-based smaller file size Vector images are made up of many individual, scalable objects. These objects are defined by mathematical equ

40、ations rather than pixels, so they always render at the highest quality. Objects may consist of lines, curves, and shapes with editable attributes such as color, fill, and outline. Changing the attributes of a vector object does not effect the object itself. You can freely change any number of objec

41、t attributes without destroying the basic object. An object can be modified not only by changing its attributes, but also by shaping and transforming it using nodes and control handles. CGM (Computer Graphics Metafile ) SVG (Scalable Vector Graphics) Raster image formats store images as a set of ind

42、ividual pixels . Key Points About Bitmap Images: pixels in a grid resolution dependent resizing reduces quality easily converted restricted to rectangle Common image formats are BMP JPEG (Joint Photographic Experts Group) , GIF( Graphics Interchange Format ), TIFF(Tagged Image File Format) PNG (Port

43、able Network Graphics ) For example (1) GIF文件不支持24位真彩色圖像,最多只能存儲256色的圖像或灰度圖像; (2)TIFF文件處理1位、4位、8位、24位非壓縮圖像,1位、4位、8位、24位packbit壓縮圖像,1位CCITT壓縮圖像等。文件內容包括文件頭、參數指針表與參數域、參數數據表和圖像數據四部分。 (3)PNG包括1位、2位、4位、8位和16位灰度圖像,8位和16位索引圖像,24位和48位真彩色圖像。 (4),BMP是一種與硬件設備無關的圖像文件格式,使用非常廣。它采用位映射存儲格式,除了圖像深度可選以外,不采用其他任何壓縮,因此,Bbl

44、P文件所占用的空間很大。BMP文件的圖像深度可選lbit、4bit、8bit及24bit。BMP文件存儲數據時,圖像的掃描方式是按從左到右、從下到上的順序。 Most bitmap images can be converted to other bitmap-based formats very easily. Bitmap images tend to have much large file sizes than vector graphics and they are often compressed to reduce their size. What is palette ? 所謂

45、調色板就是在16色或者256色位圖圖象中,將這16或者256色顏色組成的一個顏色表。對這些顏色表中的顏色按找4bits或者8bits,即0到15或者0到255進行標號,每一個標號代表其中的一種顏色。而這種顏色的標號稱為索引號。 因此,使用調色板的圖象它們的像素數值并不是實際的顏色數值,而是顏色在調色板中的索引號。 注意: (1)每一個16色或者256色位圖中都有一個調色板. palette (color lookup table).24 bit color Windows系統保留了一個有20種顏色的內部調色板-系統調色板,主要是用來繪制窗口的圖標,邊界,按紐的顏色的。所以,當新生成窗口或者應用

46、程序想按照自己的調色板顯示顏色,就必須將自己的調色板載入到系統的調色板中,這叫實現調色板。 實現調色板包括兩個步驟:一是:將調色板選入到設備上下文(Device Context);二是在Device Context中實現它。 In window system , there are two types of bitmap DDB(Device Dependent Bitmap)and DIB (Device Independent Bitmap). DDB位圖中不包含調色板信息,那么的像素數值是來自哪兒呢? 來自系統調色板中的顏色索引值。 DIB位圖文件中包含了該位圖的邏輯調色板的顏色表,它的

47、像素數值來自該調色板中的顏色表索引數值。所以兩者的區別就是,在DIB位圖文件中包含了一個RGBQUAD結構。 The structure of DIB-bmp Windows bitmap files are stored in a device-independent bitmap (DIB) format that allows Windows to display the bitmap on any type of display device. The term device independent means that the bitmap specifies pixel color

48、 in a form independent of the method used by a display to represent color. The default filename extension of a Windows DIB file is .BMP. Each bitmap file contains a bitmap-file header, a bitmap-information header, a color table( palette ), an array of bytes that defines the bitmap bits. BITMAPFILEHE

49、ADER bmfh; BITMAPINFOHEADER bmih; RGBQUAD aColors; BYTE aBitmapBits; 第一部分為位圖文件頭BITMAPFILEHEADER,是一個結構,其定義如下: Typedef struct WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; BITMAPFILEHEADER; bfType指定文件類型,必須是0 x424D,即字符串BM,也就是說所有.bmp文件的頭兩個字節都是BM bfSize指定文件大小,包括這14個字節 bf

50、Reserved1,bfReserved2為保留字,不用考慮 bfOffBits為從文件頭到實際的位圖數據的偏移字節數,即上圖中前三個部分的長度之和。 第二部分為位圖信息頭BITMAPINFOHEADER,也是一個結構,其定義如下: typedef struct DWORD biSize; LONGbiWidth; LONGbiHeight; WORDbiPlanes; WORDbiBitCount DWORD biCompression; DWORD biSizeImage; LONGbiXPelsPerMeter; LONGbiYPelsPerMeter; DWORD biClrUsed;

51、 DWORD biClrImportant; BITMAPINFOHEADER; biSize 指定這個結構的長度,為40 ; biWidth 指定圖象的寬度,單位是象素 ; biHeight 指定圖象的高度,單位是象素 ; biPlanes 必須是1,不用考慮。 biBitCount 指定表示顏色時要用到的位數,常用的值為1(黑白二色圖),4(16色圖),8(256色),24(真彩色圖)(新的.bmp格式支持32位色,這里就不做討論了)。 biCompression 指定位圖是否壓縮,有效的值為BI_RGB,BI_RLE8,BI_RLE4,BI_BITFIELDS(都是一些Windows定義好的常量)。要說明的是,Windows位圖可以采用RLE4,和RLE8的壓縮格式,但用的不多。我們今后所討論的只有第一種不壓縮的情況,即biCompression為BI_RGB的情況。 biSizeImage指定實際的位圖數據占用的字節數,其實也可以從以下的公式中計算出來:biSizeImage=biWidth*biHeight 要注意的是:上述公式中的biWidth必須是4的整倍數(所以不是biWidth,而是biWidth,表示大于或等于biWidth的,離4最近的整倍數。舉個例子,如果biWidth=240,則biWidth=240;如果biWidt

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論