PERBAIKAN CITRA Introduction Apa itu perbaikan citra? Proses peningkatan kualitas visual dari citra karena proses pengambilan gambar yang tidak ideal. (Tidak fokus, gerakan blurring, illumminasi yang jelek, dll) Menilai kualitas visual citra EE465: Introduction to Digital Image Processing 2 A Plague in Image Processing: Blur Dari mana blur itu berasal? Mengapa perlu deblurring? Optical blur: kamera out-of-focus Motion blur: Kamera bergerak Mengganggu secara visual Target yang salah untuk kompressi Jelek untuk dianalisa Numerous applications in astronomical imaging, biomedical imaging, biometrics ... EE465: Introduction to Digital Image Processing 3 Restoration Images EE465: Introduction to Digital Image Processing 4 Another Example EE465: Introduction to Digital Image Processing 5 The Real (Optical) Solution Before the repair After the repair EE465: Introduction to Digital Image Processing 6 Application (II): Medical Image Deblurring (Deconvolution) EE465: Introduction to Digital Image Processing 7 Application (III): Law Enforcement Motion-blurred license plate image EE465: Introduction to Digital Image Processing 8 Restoration Example EE465: Introduction to Digital Image Processing 9 A Grand Challenge in Iris Recognition out-of-focus iris image EE465: Introduction to Digital Image Processing 10 Modeling Blurring Process • Linear degradation model x(m,n) h(m,n) + y(m,n) w(m, n) h(m, n) blurring filter w(m, n) ~ N (0, ) 2 w additive white Gaussian noise EE465: Introduction to Digital Image Processing 11 The Curse of Noise x(m,n) h(m,n) z(m,n) + y(m,n) w(m, n) ~ N (0, w2 ) Blurring SNR z2 BSNR 10log10 2 w EE465: Introduction to Digital Image Processing 12 Image Example x(m,n) BSNR=10dB BSNR=40dB h(m,n): 1D horizontal motion blurring [1 1 1 1 1 1 1]/7 EE465: Introduction to Digital Image Processing 13 Mengapa butuh metode non linier ? Proses pemodelan degradasi citra dengan linear system muncul terutama karena dapat dinyatakan secara matematis Tetapi ada fenomena dalam visualisasi dan pencitraan secara fisik sulit dijelaskan degna persamaan sederhana secara linier Examples: relationship between illumination and luminance on a complex surface, quantization of intensity values, Gamma-correction in display devices EE465: Introduction to Digital Image Processing 14 Point Operations Overview Point operations are zero-memory operations where a given gray level x[0,L] is mapped to another gray level y[0,L] according to a transformation y f (x) y L L x L=255: for grayscale images EE465: Introduction to Digital Image Processing 15 Lazy Man Operation yx y L L x No influence on visual quality at all EE465: Introduction to Digital Image Processing 16 Digital Negative L y Lx 0 EE465: Introduction to Digital Image Processing L x 17 Contrast Stretching x y ( x a ) ya ( x b) y b 0 xa a xb bxL yb ya 0 a b L x a 50, b 150, 0.2, 2, 1, ya 30, yb 200 EE465: Introduction to Digital Image Processing 18 Clipping 0 xa 0 y ( x a) a x b (b a) b x L 0 a b L x a 50, b 150, 2 EE465: Introduction to Digital Image Processing 19 Range Compression y c log10 (1 x) 0 L x c=100 EE465: Introduction to Digital Image Processing 20 Kesimpulan operasi titik Pemetaan f(x) mengahasilkan hasil perbaikan yang berbeda beda Bagaimana memilih fungsi f(x) yang sesuai untuk sembarang citra? One systematic solution is based on the histogram information of an image Histogram equalization and specification EE465: Introduction to Digital Image Processing 21 Histogram based Enhancement Histogram of an image represents the relative frequency of occurrence of various gray levels in the image 3000 2500 2000 1500 1000 500 0 0 50 100 150 200 MATLAB function >imhist(x) EE465: Introduction to Digital Image Processing 22 Why Histogram? 4 x 10 4 3.5 3 2.5 2 1.5 1 0.5 0 0 50 100 150 200 250 It is a baby in the cradle! Histogram information reveals that image is under-exposed EE465: Introduction to Digital Image Processing 23 Another Example 7000 6000 5000 4000 3000 2000 1000 0 0 50 100 150 200 250 Over-exposed image EE465: Introduction to Digital Image Processing 24 How to Adjust the Image? Histogram equalization Basic idea: find a map f(x) such that the histogram of the modified (equalized) image is flat (uniform). Key motivation: cumulative probability function (cdf) of a random variable approximates a uniform distribution x Suppose h(t) is the histogram (pdf) s( x) h(t ) t 0 EE465: Introduction to Digital Image Processing 25 Histogram Equalization x y L h(t ) t 0 Uniform Quantization L x y s h(t ) t 0 L 0 1 Note: h(t ) 1 t 0 cumulative probability function L EE465: Introduction to Digital Image Processing x 26 MATLAB Implementation function y=hist_eq(x) [M,N]=size(x); for i=1:256 h(i)=sum(sum(x= =i-1)); End y=x;s=sum(h); for i=1:256 I=find(x= =i-1); y(I)=sum(h(1:i))/s*255; end Calculate the histogram of the input image Perform histogram equalization EE465: Introduction to Digital Image Processing 27 Ic. Histogram Equalization Histogram: diagram yang menunjukkan jumlah kemunculan grey level (0-255) pada suatu citra Histogram processing: Gambar gelap: histogram cenderung ke sebelah kiri Gambar terang: histogram cenderung ke sebelah kanan Gambar low contrast: histogram mengumpul di suatu tempat Gambar high contrast: histogram merata di semua tempat Histogram processing: mengubah bentuk histogram agar pemetaan gray level pada citra juga berubah 09/04/2015 PERTEMUAN KE-6 28 Ic. Histogram Equalization in all grey level and all area (1) Ide: mengubah pemetaan greylevel agar sebarannya (kontrasnya) lebih menyebar pada kisaran 0-255 Sifat: Grey level yang sering muncul lebih dijarangkan jaraknya dengan grey level sebelumnya Grey level yang jarang muncul bisa lebih dirapatkan jaraknya dengan grey level sebelumnya Histogram baru pasti mencapai nilai maksimal keabuan (contoh: 255) 09/04/2015 PERTEMUAN KE-6 29 Ic. Histogram Equalization in all grey level and all area (2) - mengubah pemetaan grey level pada citra, dengan rumus: k nj j 0 n sk T (rk ) k p(rj ) j 0 0 rk 1 dan k 0,1,.....,L 1 L adalah grey levelmaksimalyangada pada citra 09/04/2015 PERTEMUAN KE-6 30 Ic. Histogram Equalization in all grey level and all area (3) Citra Akhir: 19 9 95 95 9 55 91 5 55 5 9 10 10 1 Citra awal: 35554 54544 53444 45663 Contoh : citra dengan derajat keabuan hanya berkisar 0-10 Derajat Keabuan 0 1 2 3 4 5 6 7 8 9 10 Kemunculan 0 0 0 3 8 7 2 0 0 0 0 Probabilitas Kemunculan 0 0 0 0.15 0.40 0.35 0.1 0 0 0 0 Sk 0 0 0 0.15 0.55 0.90 1 1 1 1 1 SK * 10 0 0 0 1.5 5.5 9 10 10 10 10 10 Derajat keabuan baru 0 0 0 1 5 9 10 10 10 10 10 09/04/2015 PERTEMUAN KE-6 31 Ic. Histogram Equalization specific grey level (hist. specification) Histogram equalization tidak dilakukan pada seluruh bagian dari histrogram tapi hanya pada bagian tertentu saja 09/04/2015 PERTEMUAN KE-6 32 Image Example after before EE465: Introduction to Digital Image Processing 33 Histogram Comparison 3000 3000 2500 2500 2000 2000 1500 1500 1000 1000 500 0 500 0 50 100 150 200 before equalization 0 0 50 100 150 200 250 300 after equalization EE465: Introduction to Digital Image Processing 34 Application (I): Digital Photography EE465: Introduction to Digital Image Processing 35 Application (II): Iris Recognition after before EE465: Introduction to Digital Image Processing 36 Application (III): Microarray Techniques after before EE465: Introduction to Digital Image Processing 37 Frequency-Domain Techniques (I): Unsharp Masking y(m, n) x(m, n) g (m, n), 0 g(m,n) is a high-pass filtered version of x(m,n) • Example (Laplacian operator) 1 g (m, n) x(m, n) [ x(m 1, n) x(m 1, n) 4 x(m, n 1) x(m, n 1)] EE465: Introduction to Digital Image Processing 38 MATLAB Implementation % Implementation of Unsharp masking function y=unsharp_masking(x,lambda) % Laplacian operation h=[0 -1 0;-1 4 -1;0 -1 0]/4; dx=filter2(h,x); y=x+lambda*dx; EE465: Introduction to Digital Image Processing 39 1D Example 250 250 200 200 150 150 100 100 50 50 0 0 0 50 100 150 200 250 0 50 100 150 200 250 xlp(n) x(n) 220 8 200 6 4 180 2 160 0 140 -2 120 -4 100 -6 80 -8 0 50 100 150 200 250 0 50 100 150 200 250 300 300 g(n)=x(n)-xlp(n) y(n) x(n) g (n) EE465: Introduction to Digital Image Processing 40 2D Example MATLAB command >roidemo EE465: Introduction to Digital Image Processing 41 Frequency-Domain Techniques (II): Homomorphic filtering Basic idea: f ( x, y ) i ( x , y ) r ( x, y ) Illumination (low freq.) reflectance (high freq.) ln f ( x, y ) ln i( x, y ) ln r( x, y ) freq. domain enhancement EE465: Introduction to Digital Image Processing 42 Image Example after before EE465: Introduction to Digital Image Processing 43 Summary of Nonlinear Image Enhancement Understand how image degradation occurs first Play detective: look at histogram distribution, noise statistics, frequency-domain coefficients… Model image degradation mathematically and try inverseengineering Visual quality is often the simplest way of evaluating the effectiveness, but it will be more desirable to measure the performance at a system level Iris recognition: ROC curve of overall system Microarray: ground-truth of microarray image segmentation result provided by biologists EE465: Introduction to Digital Image Processing 44