370 likes | 523 Views
Image Compression : Basic Concept. Image is accessed ( 存取 ) as a 2-D array ( 陣列 ) of data, where each data point is referred to as a pixel ( 像素 ) Notation: I(r,c) = Brightness ( 亮度 ) of image at the pt (r,c) where r = row( 列 ), and c = column( 行 ). Visible Light Imaging.
E N D
Image is accessed (存取) as a 2-D array (陣列) of data, where each data point is referred to as a pixel (像素) Notation: I(r,c) = Brightness (亮度) of image at the pt (r,c) where r = row(列), and c = column(行)
Visible Light Imaging • Reflectance (反射) function determines manner in which objects (物體) reflect light
Sensors : Converts (轉換) light energy into electrical energy a) Single imaging sensor ; b) Linear ( line) sensor ; c) 2-D or array sensor • CCD: 4kx4k CMOS: less power, cheaper, image quality not as good as CCD
Image Representation • Optical (光學) image : Collection of spatially distributed (空間分佈) light energy measured by an image sensor to generate I(r,c) • Matrix: 2-D array like the image model, I(r,c) • Vector: One row or column in a matrix
Image Types • Binary (二元化) images: Simplest type of images, which can take two values, typically black or white, or “0” or “1” • Gray scale (灰階) images: One-color or monochrome images that contains only brightness information and no color information • Color images: 3 band monochrome images, where each band corresponds to a different color, typically red, blue and green or RGB
Color pixel vector: Single pixel’s values for a color image, (R,G,B) • Multispectral(多光譜)Images: Images of many bands containing information outside of the visible spectrum(可見光譜)
Color Transform/Color Model • Mathematical model or algorithm to map(映射) RGB data into another color space (色彩空間) • Decouples (分開) brightness and color information • Hue(色調)/Saturation(飽和度)/Lightness(亮度) (HSL) Color Transform: • Describes colors in terms that we can more readily understand
Hue corresponds to color, saturation corresponds to the amount of white in color, and lightness is the brightness • For example: a deep, bright orange color would have a large intensity (bright), a hue of “orange” , and a high value of saturation (“deep(深度)”) But in terms of RGB components, this color would have the values as R =245, G= 110, and B=20
Digital Image File Formats • Bitmap images (raster images): Images that can be represented by our image model, I (r,c)
Image file header (檔案標頭): A set of parameters (參數) found at the start of the file image and contains information regarding: • Number of rows (列數)(height, 高) • Number of columns (行數)(width, 寬) • Number of bands (頻帶數) • Number of bits per pixel (每個像數之位 元數)(bpp) • File type (檔案形式)
Look-up table (LUT): Used for storing RGB values for 8-bit color images
Common image file formats are: • BIN, RAW • PPM,PBM,PGM • BMP • JPEG • TIFF • GIF • RAS • SGI • PNG • PICT, FPX • EPS • VIP
Matlab 影像處理I/O相關指令簡介 • 在Matlab中,每一個像素(pixel)之顏色係以0到1之數值來表示。1代表最亮,0代表最暗。 • 彩色的組成係由RGB,也就是 red(紅) 、green(綠) 、blue(籃)的色階來構成。 • 影像之處理係基於矩陣的運算,矩陣內的數值,代表了影像的強弱。
Matlab 影像處理I/O相關指令簡介 • 黑白影像用二維的矩陣來表示,彩色的影像則需藉助三維的矩陣來表示RGB 在該一位置的色濃度。
Matlab 影像處理I/O相關指令簡介 • Show 圖指令imshow( ) • 其指令格式為:imshow(影像矩陣 A,色階 N) ,代表影像矩陣 A以N個色階來顯示黑白影像。 • 若N未設定,則對24位元之影像,內定為256色階。 • 影像矩陣A以三維空間A( : , : , 3)來表示彩色影像,A(: , : , 1)表示紅色之色階; A(: , : , 2)表示綠色之色階; A(: , : , 3)表示籃色之色階。
Matlab 影像處理I/O相關指令簡介 • 另外一種設定為設定界限值,以便讓圖形在範圍以下顯示黑色,在範圍以上顯示白色。指令格式為:imshow(影像矩陣 A, [ lim_l lim_h]) • 代表影像矩陣 A 中的值若小於lim_l,則顯示黑色;若大於lim_h,則顯示白色。
Matlab 影像處理I/O相關指令簡介 • 若已經有了現成的影像檔,希望讀入Matlab的workspace中,可用imread(‘檔案名稱’)讀入,再用imshow( )顯示出來即可。 • imwrite( )可用來將影像寫入影像檔中,其指令格式為:imwrite(影像來源, 寫入之影像檔名稱, ‘影像格式’)
Ex2_1.m • clear; close all; • A=imread('1.bmp'); • figure % 開繪圖視窗 • imshow(A); • size(A) • figure • imshow(A(:,:,2)); %僅show綠色部份 • imwrite(A(:,:,2),'ex2_1.tif','tif'); • B=A(100:150,150:200,1); %取紅色之部份影像 • figure • imshow(B); • figure • imshow(B,[100 200]);
Image compression using artificial neural networks • Conventional compression techniques are designed for low noise environments, i.e., bit error rate • Neural networks are suitable for high noise environments, i.e., bit error rate S/N for JPAG algorithm under compression ratio 8:1
Image compression using artificial neural networks 10張(256x256, 24bits)訓練影像
Image compression using artificial neural networks 8 256 8 256 3 64-8-64 networks
Image compression using artificial neural networks Original image Decompressed image 33.0405db Peak S/N: 30.1983db
Image compression using artificial neural networks Comparison of the S/N under compression ratio 8:1
影像處理 • 影像的空間資料結構表示法---四分樹表示法 • 以四分樹為基礎之類神經網路影像壓縮
黑白影像的四分樹表示法 • 四分樹切割 給一張黑白影像如圖1所示。利用四分樹的切割方式,可將圖1的影像以樹狀的方式表示成圖2。 圖1 黑白影像 圖2 四分樹表示法
灰階影像的四分樹表示法 • 給一張灰階影像,利用四分樹的切割方式,亦可將影像以樹狀的方式來表示。 • 某子影像(block)是否繼續分割是依據該子影像內之gray level 範圍是否超出臨界值(0<threshold<1)
灰階影像的四分樹表示法 Threshold = 0.27 S為一稀疏矩陣其非零 元素表一block之左上角 之位置而其非零元素之 值表該Block之size
灰階影像的四分樹表示法 Threshold = 0.5 Threshold 愈大, block 數目愈少
灰階影像的四分樹表示法 Threshold = 0.75 Threshold 愈大, block 數目愈少
類神經網路影像壓縮 • Conventional compression techniques are designed for low noise environments, i.e., bit error rate • Neural networks are suitable for high noise environments, i.e., bit error rate S/N for JPAG algorithm under compression ratio 8:1
類神經網路影像壓縮 8 256 8 256 64-8-64, 16-4-16, and 4-2-4 networks
類神經網路影像壓縮 Block size 64 (8 x 8) 上限 16 (4 x 4) 4 (2 x 2) 下限 Depth first search
類神經網路影像壓縮 Comparison of the S/N under compression ratio 8:1