Vien tham - 9 chuyen doi anh - a
Transcript of Vien tham - 9 chuyen doi anh - a
![Page 1: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/1.jpg)
CHUYỂN ĐỔI ẢNHCHUYỂN ĐỔI ẢNH
BIẾN ĐỔI CẤP ĐỘ XÁMBIẾN ĐỔI CẤP ĐỘ XÁM
BỘ MÔN ĐỊA TIN HỌC
![Page 2: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/2.jpg)
NỘI DUNG
1. Khái niệm ảnh số
2. Histogram
3. Các phép biến đổi tuyến tính
4. Các phép biến đổi histogram
5. Một số phép biến đổi khác
![Page 3: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/3.jpg)
1. Ảnh số
Pixel (Picture Element): đi m nh, mang m t gể ả ộiá tr s f(x,y)ị ố
x,y: s nguyên, ch v trí pixelố ỉ ịBV: đ sáng (đ xám, brightness)ộ ộ
CONTINUOUS IMAGE
PIXEL
0 1 2 3
X, Column Pixel No.
012
3
Y, LineAnalog Image Digital Image
Height
Width
![Page 4: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/4.jpg)
Pixel
Giá tr c a Pixelị ủ
![Page 5: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/5.jpg)
Ảnh đa phổ (đa kênh)Multi Channel Image
Color Image: 3 kênh cho 3 màu R,G,BLandsat TM7 Channel
Band or Channel
Band 4Band
3Band 2Band
1
![Page 6: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/6.jpg)
Bit và hệ Nhị phân (Binary System)
sáng c a m i pixel đ c bi u di n b i m t s bitĐộ ủ ỗ ượ ể ễ ở ộ ốN u dùng k bit cho m i pixel, có t t c 2ế ỗ ấ ả k c p đ sáng t 0 ấ ộ ừđ n 2ế k -1
Ví d : dùng 3 bitụ
bit map graylevel bitmap graylevelbit2 bit1 bit0 bit2 bit1 bit00 0 0 0 1 0 0 40 0 1 1 1 0 1 50 1 0 2 1 1 0 60 1 1 3 1 1 1 7
![Page 7: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/7.jpg)
1bit2bit3bit
8bit
4bit
5bit6bit7bit
Các mức lượng hóa khác nhau
![Page 8: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/8.jpg)
Khái niệm lân cận (Neighbor) của một Pixel
p p
4-neighbors of p 8-neighbors of p
![Page 9: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/9.jpg)
Tính liên tục của các pixel
continuous at 4-connectivity
continuous at 8-connectivity
![Page 10: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/10.jpg)
2. Histogram của ảnh
Histogram (bi u đ xám) mô t s phân b c a c p để ồ ả ự ố ủ ấ sáng c a m t nh theo s l ng pixel mang cùng ộ ủ ộ ả ố ượ
m t giá tr đ sángộ ị ộ
1 3 2 4
4 5 2 3
3 2 3 2
3 3 4 3
PixelValue Number
1 12 43 74 35 1
Total 16
HistogramHistogram
012345678
1 2 3 4 5
Pixel Value
Freq
uenc
y
![Page 11: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/11.jpg)
Ví dụ minh hoạ Histogram
Có 15,563 pixels mang giá tr 76ị
![Page 12: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/12.jpg)
Histogram và tính chất của ảnh
0 255pixel value 0 255pixel value
0 255pixel value 0 255pixel value
Dark Image Bright Image
Low Contrast Image
High Contrast Image
Tối & Sáng
Tương phản cao & thấp
![Page 13: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/13.jpg)
Ảnh tối
![Page 14: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/14.jpg)
Ảnh sáng
![Page 15: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/15.jpg)
Ảnh có độ tương phản thấp
![Page 16: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/16.jpg)
Ảnh có độ tương phản cao
![Page 17: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/17.jpg)
3. Biến đổi tuyến tính Linear Transformation Function
255Value of Input Image
255
Val
ue o
f
Out
put I
mag
e
0
Dark Low Contrast Image
High Contrast Image
Transformation Function Brightness on a Display Screen
0: Darkest
255: Brightest
y=x: No Transformation
Dark Low Contrast Image
![Page 18: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/18.jpg)
Công thức tuyến tính
y
xx1 x2y 1
y2 1112
12 )( yxxxx
yyy
![Page 19: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/19.jpg)
Chọn khoảng giá trị input cho phép biến đổi (range of input level)
Rejection Level e.g. 1%
1%
98 %
1%
2550
255
a b
No Rejection Level
Min
100 %
Max
2550
255
ab
![Page 20: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/20.jpg)
4. Biến đổi Histogram
Equalization (đẳng hóa) Nhằm tạo ra một số bằng nhau các p
ixel cho mỗi giá trị độ sáng Gaussian
Chuyển histogram sang phân bố Gaussian
2550
Frequency
Pixel Value
2550
Frequency
Pixel Value
2
2
2
)(exp
2
1)(
x
xf
![Page 21: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/21.jpg)
Giải thuật equalization
N = số pixel ; L = số lượng cấp độ sáng
a) Tính biểu đồ xám tích lũy (cummulative histogram) của ảnh gốc
b) Chia biểu đồ xám tích lũy cho hệ số L-1 / N rồi làm tròn số
c) Với mỗi giá trị độ sáng của ảnh gốc, giá trị mới ở vị trí tương ứng ở (b)
![Page 22: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/22.jpg)
Ví dụ
5
4
3
2
1
00 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ảnh gốc
N=24 L=16
==> scale factor = 15 / 24 = 0.625
![Page 23: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/23.jpg)
Bước a) - cummulative histogram
25
20
15
10
5
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
![Page 24: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/24.jpg)
Bước b) - Chia biểu đồ xám tích lũy cho hệ số 0.6
25 rồi làm tròn số
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 2 5 9 14 18 19 19 19 19 19 19 19 20 23 24
0.63 1.25 3.13 5.63 8.75 11.25 11.88 11.88 11.88 11.88 11.88 11.88 11.88 12.50 14.40 15.00
1 1 3 6 9 11 12 12 12 12 12 12 12 13 14 15
![Page 25: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/25.jpg)
Bước c) - phép tương ứng
5
4
3
2
1
00 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 1 3 6 9 11 12 12 12 12 12 12 12 13 14 15
Equalization histogram
![Page 26: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/26.jpg)
Ví dụ
5
4
3
2
1
00 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ảnh gốc
N=24 L=16
==> scale factor = 15 / 24 = 0.625
![Page 27: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/27.jpg)
Cân bằng 2 histogram (Histogram matching)
Cần thiết khi mosaic 2 ảnh của 2 vùng kế cận (có thể có overlap)
Nguyên tắc: làm cho độ sáng của 2 ảnh gần nhau đến mức có thể được
Phương pháp: dùng ảnh equalization làm trung gian của phép biến đổi
z=f(x) z=g(y)
y = g-1f(x)
AB
![Page 28: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/28.jpg)
Cân bằng 2 histogram (Histogram matching)
Như vậy, ánh xạ y=f-1(g(x) biến đổi ảnh A thành ảnh B Ảnh B gọi là ảnh reference Trong thực hành, phép biến đổi được thực hiện thông qua á
nh xạ “matching” accumulative histogram của ảnh A với accumulative histogram của ảnh B
Chú ý: thay cho ảnh reference B, có thể dùng một hàm tóan học (biểu thị một sự phân bố nào đó - ví dụ như phân bố chuẩn)
![Page 29: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/29.jpg)
Ví dụ
Gaussian
EqualizationEqualization
nh g cả ốnh g cả ố
![Page 30: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/30.jpg)
5. Các phương pháp khác
Biến đổi tuyến tính từng đọan (Piecewise linear transforamtion)
![Page 31: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/31.jpg)
Biến đổi tuyến tính dựa trên trị trung bình và độ lệch chuẩn
y
xx1 x2y1
y2
mmx
y yxxS
Sy )(
![Page 32: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/32.jpg)
Biến đổi không tuyến tính
y
xx1 x2y 1
y2
(ví d sau áp d ng cho tr ng h p mi n giá tr c a ụ ụ ườ ợ ề ị ủ ảnh g c r t l n)ố ấ ớ
1112
12 )log(logloglog
yxxxx
yyy
![Page 33: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/33.jpg)
Thresholding
• Phân h ach các pixel thành 2 l p xác đ nh b i ọ ớ ị ởm t c p đ sáng (g i là threshold)ộ ậ ộ ọ
• N u giá tr c a pixel (x,y) nh h n threshhold, (xế ị ủ ỏ ơ,y) thu c l p (I), n u không (x,y) thu c l p (II)ộ ớ ế ộ ớ
• Có th m r ng khái ni m cho nhi u l pể ở ộ ệ ề ớ
==> Thresholding có thể xem là một cách phân lớp (classification) nhanh
![Page 34: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/34.jpg)
ảnh gốc
![Page 35: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/35.jpg)
Threshold 128
![Page 36: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/36.jpg)
Threshold 28
![Page 37: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/37.jpg)
Biến đổi ảnh dùng bảng tra(LUT - Look Up Table)
4
812
16
2
LUT
0
1
2
3
Input Output12
255 255255254
LUT element
No.
Hardware or 1-dim Array in Program
.
.. .
Look Up Table: Tính tóan nhanh do không s d ng phép tính ử ụ
s h cố ọ
![Page 38: Vien tham - 9 chuyen doi anh - a](https://reader036.fdocument.pub/reader036/viewer/2022062419/558a5be5d8b42ac41b8b461e/html5/thumbnails/38.jpg)
Một ví dụ dùng Look Up Table