Pengolahan Citra Digital Konsep Dasar Representasi Citra Dr

  • Slides: 59
Download presentation
Pengolahan Citra Digital: Konsep Dasar Representasi Citra Dr. Ir. Sumijan, M. Sc 1

Pengolahan Citra Digital: Konsep Dasar Representasi Citra Dr. Ir. Sumijan, M. Sc 1

PEMBENTUKAN CITRA Kontinu dihasilkan dari sistem optik yang menerima sinyal analog, contoh : mata

PEMBENTUKAN CITRA Kontinu dihasilkan dari sistem optik yang menerima sinyal analog, contoh : mata manusia Citra Diskrit (Citra Digital) dihasilkan melalui proses digitalisasi terhadap citra kontinu 2

PEMBENTUKAN CITRA Citra Fungsi kontinu dari intensitas cahaya pada bidang dua dimensi. Sumber Cahaya

PEMBENTUKAN CITRA Citra Fungsi kontinu dari intensitas cahaya pada bidang dua dimensi. Sumber Cahaya i(x, y) Permukaan normal f(x, y) 3

PEMBENTUKAN CITRA (x, y) koordinat pada bidang dua dimensi f(x, y) intensitas cahaya (brightness)

PEMBENTUKAN CITRA (x, y) koordinat pada bidang dua dimensi f(x, y) intensitas cahaya (brightness) pada titik (x, y) i(x, y) Jumlah cahaya yang berasal dari sumbernya (illumination) r(x, y) Derajat kemampuan obyek memantulkan cahaya (Reflection). f(x, y) = i(x, y). r(x, y) 4

DIGITALISASI CITRA Digitalisasi Representasi citra dari fungsi kontinu menjadi nilai – nilai diskrit. Ukuran

DIGITALISASI CITRA Digitalisasi Representasi citra dari fungsi kontinu menjadi nilai – nilai diskrit. Ukuran dimensi citra digital dinyatakan sebagai : tinggi x lebar atau N x M dan memiliki derajat keabuan L 5

DIGITALISASI CITRA Proses Digitalisasi ada 2 macam : Penerokan (sampling) digitalisasi spasial (x, y)

DIGITALISASI CITRA Proses Digitalisasi ada 2 macam : Penerokan (sampling) digitalisasi spasial (x, y) Kuantisasi digitalisasi intensitas f(x, y) Column of samples Pixel Black 255 Gray 128 White 0 Line Spacing Picture Sample Spacing Sampling process Spatial resolution Brightness Spacing Proses Kwantisasi Brightness Resolution 6

DIGITALISASI CITRA - PENEROKAN Elemen Gambar Elemen Matriks 0 Dy y M-1 0 i

DIGITALISASI CITRA - PENEROKAN Elemen Gambar Elemen Matriks 0 Dy y M-1 0 i Dx Dy M Pixel N Pixel (0, 0) x Dx N-1 j Hubungan antara elemen gambar dan elemen matriks 7

DIGITALISASI CITRA-KUANTISASI Kuantisasi membagi skala keabuan (0, L) menjadi G level G= Skala Keabuan

DIGITALISASI CITRA-KUANTISASI Kuantisasi membagi skala keabuan (0, L) menjadi G level G= Skala Keabuan 2 m G = derajat keabuan m = bilangan bulat positif Rentang Nilai Keabuan Pixel Depth 21 0, 1 1 bit 22 0 sampai 7 2 bit 23 0 sampai 15 3 bit 28 0 sampai 255 8 bit 8

ELEMEN-ELEMEN CITRA DIGITAL 1. Kecerahan (brightness) 2. Kontras (contrast) 3. Kontur (contour) 4. Warna

ELEMEN-ELEMEN CITRA DIGITAL 1. Kecerahan (brightness) 2. Kontras (contrast) 3. Kontur (contour) 4. Warna (color) 5. Bentuk (shape) 6. Tekstur (texture) 9

FORMAT BERKAS BITMAP (BMP) Bitmap Pemetaan Bit. Nilai intensitas pixel di dalam citra dipetakan

FORMAT BERKAS BITMAP (BMP) Bitmap Pemetaan Bit. Nilai intensitas pixel di dalam citra dipetakan ke sejumlah bit tertentu. Warna dalam citra bitmap kombinasi dari 3 warna : Red (R) , Green (G) , Blue (B). Citra dalam BMP ada 3 : 1. Citra biner nilai keabuannya hanya 0 dan 1 2. Citra greyscale nilai keabuannya 8 -bit 3. Citra berwarna nilai keabuannya 24 -bit 10

HUBUNGAN ANTARA PIKSEL 4 -tetangga piksel P X X 8 -tetangga piksel P X

HUBUNGAN ANTARA PIKSEL 4 -tetangga piksel P X X 8 -tetangga piksel P X X X X Connectivity/Konektivitas: 4 -tetangga atau 8 -tetangga dengan kriteria gray level yang sama, misal: sama-sama 0 atau sama 1 atau sama-sama bedanya tidak lebih dari 5 tingkat keabuan, dlsb. nya 11

LABELLING OF CONNECTED COMPONENT Dengan kriteria piksel sama-sama bernilai 1: (a) dengan aturan 4

LABELLING OF CONNECTED COMPONENT Dengan kriteria piksel sama-sama bernilai 1: (a) dengan aturan 4 tetangga dan (b) dengan aturan 8 tetangga: 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 ekivalen dengan 12

OPERASI ARITMATIK v v v + - x / Band ratio antara citra sensor

OPERASI ARITMATIK v v v + - x / Band ratio antara citra sensor optik Landsat TM band 3 dan band 4 dapat digunakan untuk analisis vegetasi, begitu juga ratio antara selisih dan jumlahnya. Operasi selisih antara dua citra temporal dapat digunakan untuk deteksi perubahan wilayah. 13

Operasi jumlah matrik n The add filter takes two images (source and overlay images)

Operasi jumlah matrik n The add filter takes two images (source and overlay images) of the same size and pixel format and produces an image, where each pixel equals to the sum value of corresponding pixels from provided images (if sum is greater than maximum allowed value, 255 or 65535, then it is truncated to that maximum

n n n n X = ([ 255 0 75; 44 225 100]); Y

n n n n X = ([ 255 0 75; 44 225 100]); Y = ([ 50 50 50; 50 50 50 ]); Z = X+Y Z= 255 50 125 94 255 150

Pengurangan matrik n The subtract filter takes two images (source and overlay images) of

Pengurangan matrik n The subtract filter takes two images (source and overlay images) of the same size and pixel format and produces an image, where each pixel equals to the difference value of corresponding pixels from provided images (if difference is less than minimum allowed value, 0, then it is truncated to that minimum value

Pembagian n n n n Hasil pembagiannya dibulatkan X = ([ 255 10 75;

Pembagian n n n n Hasil pembagiannya dibulatkan X = ([ 255 10 75; 44 225 100]); Y = ([ 50 20 50; 50 50 50 ]); Z = X/Y Z= 5 1 2 1 5 2

Perkalian n Hasil perkalinnya dibulatkan

Perkalian n Hasil perkalinnya dibulatkan

OPERASI ARITMATIK n Operasi selisih antara dua citra temporal dapat digunakan untuk deteksi perubahan

OPERASI ARITMATIK n Operasi selisih antara dua citra temporal dapat digunakan untuk deteksi perubahan wilayah. Jakarta in 1994 Jakarta in 1998 19

Complement Image n n n X = uint 8([ 255 10 75; 44 225

Complement Image n n n X = uint 8([ 255 10 75; 44 225 100]); X 2 = imcomplement(X) X 2 = 0 245 180 211 30 155

OPERASI GEOMETRI Memodifikasi koordinat piksel dalam suatu citra dengan kemungkinan mengubah nilai skala keabuan

OPERASI GEOMETRI Memodifikasi koordinat piksel dalam suatu citra dengan kemungkinan mengubah nilai skala keabuan dari titik dengan pendekatan tertentu. Transformasi Spasial memetakan koordinat titik – titik citra asal ke koordinat titik – titik di citra hasil. 21

APLIKASI OPERASI GEOMETRI n n Pencerminan (flipping) Rotasi / pemutaran (rotating) Penskalaan (scaling /

APLIKASI OPERASI GEOMETRI n n Pencerminan (flipping) Rotasi / pemutaran (rotating) Penskalaan (scaling / zooming) Pembekokan (warping) 22

Image Interpolation n Introduction ¡ ¡ n Interpolation Techniques ¡ n Apa itu interpolasi?

Image Interpolation n Introduction ¡ ¡ n Interpolation Techniques ¡ n Apa itu interpolasi? Mengapa kita butuh interpolasi? 1 D zero-order, first-order, third-order Interpolation Applications ¡ ¡ ¡ Digital zooming (perbaikan resolution Image inpainting (error concealment) Transformasi geometri EE 465: Introduction to Digital Image Processing 23

Introduction (Con’t) n Mengapa butuh interpolasi? ¡ Ingin citra yang besar n ¡ Kita

Introduction (Con’t) n Mengapa butuh interpolasi? ¡ Ingin citra yang besar n ¡ Kita ingin gambar yang baik n ¡ Contoh, ingin tampilan full screen Perbaikan citra karena ada error pada proses transmisi Kita ingin COOL images n Manipulasi citra yang artistik EE 465: Introduction to Digital Image Processing 24

Scenario I: perbaikan Citra Low-Res. High-Res. EE 465: Introduction to Digital Image Processing 25

Scenario I: perbaikan Citra Low-Res. High-Res. EE 465: Introduction to Digital Image Processing 25

Penskalaan 26

Penskalaan 26

Scenario II: Image Inpainting Non-damaged Damaged EE 465: Introduction to Digital Image Processing 27

Scenario II: Image Inpainting Non-damaged Damaged EE 465: Introduction to Digital Image Processing 27

Scenario III: Image Warping EE 465: Introduction to Digital Image Processing 28

Scenario III: Image Warping EE 465: Introduction to Digital Image Processing 28

 • Interpolation Techniques EE 465: Introduction to Digital Image Processing 29

• Interpolation Techniques EE 465: Introduction to Digital Image Processing 29

1 D Zero-order (Replication) f(n) n f(x) x EE 465: Introduction to Digital Image

1 D Zero-order (Replication) f(n) n f(x) x EE 465: Introduction to Digital Image Processing 30

1 D First-order Interpolation (Linear) f(n) n f(x) x EE 465: Introduction to Digital

1 D First-order Interpolation (Linear) f(n) n f(x) x EE 465: Introduction to Digital Image Processing 31

Linear Interpolation Formula Basic idea: the closer to a pixel, the higher weight is

Linear Interpolation Formula Basic idea: the closer to a pixel, the higher weight is assigned f(n) f(n+a) a f(n+1) 1 -a f(n+a)=(1 -a) f(n)+a f(n+1), 0<a<1 Note: when a=0. 5, we simply have the average of two EE 465: Introduction to Digital Image Processing 32

Numerical Examples f(n)=[0, 120, 180, 120, 0] Interpolate at 1/2 -pixel f(x)=[0, 60, 120,

Numerical Examples f(n)=[0, 120, 180, 120, 0] Interpolate at 1/2 -pixel f(x)=[0, 60, 120, 150, 180, 150, 120, 60, 0], x=n/2 Interpolate at 1/3 -pixel f(x)=[0, 20, 40, 60, 80, 100, 120, 130, 140, 150, 160, 170, 180, …], x=n/6 EE 465: Introduction to Digital Image Processing 33

1 D Third-order Interpolation (Cubic) f(n) n f(x) x Cubic spline fitting EE 465:

1 D Third-order Interpolation (Cubic) f(n) n f(x) x Cubic spline fitting EE 465: Introduction to Digital Image Processing 34

Graphical Interpretation of Interpolation row column f(m, n) g(m, n) EE 465: Introduction to

Graphical Interpretation of Interpolation row column f(m, n) g(m, n) EE 465: Introduction to Digital Image Processing 35

Numerical Examples zero-order a a b b c c d d a b c

Numerical Examples zero-order a a b b c c d d a b c d first-order a (a+c)/2 c (a+b)/2 (a+b+c+d)/4 (c+d)/2 EE 465: Introduction to Digital Image Processing b (b+d)/2 d 36

Numerical Examples (Con’t) Col n+1 Col n X(m, n) row m a X(m, n+1)

Numerical Examples (Con’t) Col n+1 Col n X(m, n) row m a X(m, n+1) b Y 1 -a 1 -b row m+1 X(m+1, n) X(m+1, n+1) Q: what is the interpolated value at Y? Ans. : (1 -a)(1 -b)X(m, n)+(1 -a)b. X(m+1, n) +a(1 -b)X(m, n+1)+ab. X(m+1, n+1) EE 465: Introduction to Digital Image Processing 37

Bicubic Interpolation* EE 465: Introduction to Digital Image Processing 38

Bicubic Interpolation* EE 465: Introduction to Digital Image Processing 38

Pixel Replication low-resolution image (100× 100) high-resolution image (400× 400) EE 465: Introduction to

Pixel Replication low-resolution image (100× 100) high-resolution image (400× 400) EE 465: Introduction to Digital Image Processing 39

Bilinear Interpolation low-resolution image (100× 100) high-resolution image (400× 400) EE 465: Introduction to

Bilinear Interpolation low-resolution image (100× 100) high-resolution image (400× 400) EE 465: Introduction to Digital Image Processing 40

Bicubic Interpolation low-resolution image (100× 100) high-resolution image (400× 400) EE 465: Introduction to

Bicubic Interpolation low-resolution image (100× 100) high-resolution image (400× 400) EE 465: Introduction to Digital Image Processing 41

Error Concealment damaged interpolated EE 465: Introduction to Digital Image Processing 42

Error Concealment damaged interpolated EE 465: Introduction to Digital Image Processing 42

Geometric Transformation Widely used in computer graphics to generate special effects MATLAB functions: griddata,

Geometric Transformation Widely used in computer graphics to generate special effects MATLAB functions: griddata, interp 2, maketform, imtransform EE 465: Introduction to Digital Image Processing 43

Basic Principle (x, y) (x’, y’) is a geometric transformation n We are given

Basic Principle (x, y) (x’, y’) is a geometric transformation n We are given pixel values at (x, y) and want to interpolate the unknown values at (x’, y’) n Usually (x’, y’) are not integers and therefore we can use linear MATLAB implementation: to z’=interp 2(x, y, z, x’, y’, method); interpolation guess their values n EE 465: Introduction to Digital Image Processing 44

Rotation y’ y x’ θ x EE 465: Introduction to Digital Image Processing 45

Rotation y’ y x’ θ x EE 465: Introduction to Digital Image Processing 45

MATLAB Example z=imread('cameraman. tif'); % original coordinates [x, y]=meshgrid(1: 256, 1: 256); % new

MATLAB Example z=imread('cameraman. tif'); % original coordinates [x, y]=meshgrid(1: 256, 1: 256); % new coordinates a=2; for i=1: 256; for j=1: 256; x 1(i, j)=a*x(i, j); y 1(i, j=y(i, j)/a; end % Do the interpolation z 1=interp 2(x, y, z, x 1, y 1, 'cubic'); EE 465: Introduction to Digital Image Processing 46

Rotation Example θ=3 o EE 465: Introduction to Digital Image Processing 47

Rotation Example θ=3 o EE 465: Introduction to Digital Image Processing 47

Scale a=1/2 EE 465: Introduction to Digital Image Processing 48

Scale a=1/2 EE 465: Introduction to Digital Image Processing 48

Affine Transform square parallelogram EE 465: Introduction to Digital Image Processing 49

Affine Transform square parallelogram EE 465: Introduction to Digital Image Processing 49

Affine Transform Example EE 465: Introduction to Digital Image Processing 50

Affine Transform Example EE 465: Introduction to Digital Image Processing 50

Shear square parallelogram EE 465: Introduction to Digital Image Processing 51

Shear square parallelogram EE 465: Introduction to Digital Image Processing 51

Shear Example EE 465: Introduction to Digital Image Processing 52

Shear Example EE 465: Introduction to Digital Image Processing 52

Projective Transform B’ B A D A’ C’ C D’ square quadrilateral EE 465:

Projective Transform B’ B A D A’ C’ C D’ square quadrilateral EE 465: Introduction to Digital Image Processing 53

Projective Transform Example [ 0 0; 1 1; 0 1] [-4 2; -8 -3;

Projective Transform Example [ 0 0; 1 1; 0 1] [-4 2; -8 -3; -3 -5; 6 3] EE 465: Introduction to Digital Image Processing 54

APLIKASI OPERASI GEOMETRI Rotasi 55

APLIKASI OPERASI GEOMETRI Rotasi 55

SUMMARY n Operasi berbasis bingkai / frame adalah operasi yang melibatkan 2 buah citra

SUMMARY n Operasi berbasis bingkai / frame adalah operasi yang melibatkan 2 buah citra atau lebih dan menghasilkan sebuah citra keluaran yang merupakan hasil operasi matematis ( operasi aritmatik dan operasi logika ) 56

SUMMARY n n Contoh implementasi operasi berbasis bingkai antara lain image blending, dan deteksi

SUMMARY n n Contoh implementasi operasi berbasis bingkai antara lain image blending, dan deteksi gerak. Operasi Geometrik berhubungan dengan perubahan bentuk geometrik citra, yaitu ukuran ataupun orientasinya. 57

TUGAS n Buat Program aplikasi pengolahan citra digital untuk operasi aritmatik / geometri 58

TUGAS n Buat Program aplikasi pengolahan citra digital untuk operasi aritmatik / geometri 58

REFERENSI 1. 2. 3. Rafael C. Gonzales dan Richard E. Woods, Digital Image Processing,

REFERENSI 1. 2. 3. Rafael C. Gonzales dan Richard E. Woods, Digital Image Processing, Edisi 2, Prentice Hall, 2002 Rafael C. Gonzales, Richard E. Woods dan Steven L. Eddins, Digital Image Processing using Mathlab, Prentice Hall, 2003 Achmad Balza, Firdausy Kartika. Teknik Pengolahan Citra Digital dengan Delphi. Ardi Publishing. Yogyakarta. 2005. 59