You are on page 1of 15

Review

Data image dinyatakan sebagai matrik dengan ukuran matrik adalah resolusi (ukuran image) dan nilai tiap elemennya adalah nilai warna dari setiap pixel pada image tersebut.

Point Operation
Dosen Pembina Sriyani Violina Danang Junaedi
Kuantisasi pada image adalah banyaknya level warna yang digunakan untuk menyatakan dari warna yang paling gelap (hitam) sampai warna yang paling terang sesuai satuan atau format warna yang digunakan.

IF-UTAMA

IF-UTAMA

Digital Image Processing


Function of Image Processing: to change perceived / viewed image contrast perceived / viewed image colour perceived spatial information reduce image noise change viewing conditions segmentation / pattern recognition

General Areas of Image Processing


3 general areas of digital image processing Point Operations Pixel Point Processing Local Operations Pixel Group Processing Global Operations

IF-UTAMA

IF-UTAMA

IF-UTAMA

Basics of Digital Images (review)


Digital images are a 2D array of values in rows and columns given by I(x,y) (or some by I(c,r))
0 1 2 3 4 5 6 7 8 0 152 3 234 141 241 45 127 162 64 102 213 227 1 120 114 72 214 154 95 98 81 123 189 235 103 2 22 199 65 169 141 65 137 83 130 174 219 192 3 215 134 17 134 231 127 149 189 100 35 137 243 4 34 88 145 85 145 123 67 69 58 169 22 102 4 1 20 185 234 236 94 45 195 226 203 195 220 6 0 60 235 237 35 47 52 94 214 243 168 187 117 199 181 68 27 166 29 171 34 135 208 21

Point Operations / Intensity Transform


Basic idea Zero memory operation each output only depend on the input intensity at the point Map a given gray or color level u to a new level v, i.e. v = f ( u ) Doesnt bring in new info. But can improve visual appearance or make features easier to detect Example-1: Color coordinate transformations RGB of each pixel luminance + chrominance components etc. Example-2: Scalar quantization quantize pixel luminance/color with fewer bits v
output gray level

input gray level


IF-UTAMA 5 IF-UTAMA

u
6

Operasi Aljabar
X opr Y = Z X: citra Y: citra atau besaran skalar Z: citra Level komputasi: Berbasis titik (pointwise): dilakukan antara tiap elemen X dan Y Berbasis matriks: melibatkan matriks ketetanggaan

Operasi-operasi Dasar Pengolahan Citra Operasi Aljabar : Aritmatika & Boolean Operasi Geometri

IF-UTAMA

Operasi Aritmatika
Beberapa operasi aritmatika: Penjumlahan Pengurangan Perkalian Pembagian
Untuk citra RGB, operasi dilakukan per plane

Efek Penjumlahan pada Citra


Y citra: Z adalah jumlah nilai brightness dari tiap pixel pada X dan Y Y besaran skalar: Z adalah versi yang lebih terang dari citra X nilai kenaikan brightness sama dengan Y

Efek Pengurangan pada Citra


Y citra: Z adalah perbedaan nilai brightness antar X dan Y Y besaran skalar: Z adalah versi yang lebih gelap daripada X nilai penurunan brightness sama dengan Y

Efek Perkalian & Pembagian pada Citra


Perkalian Y citra: Z adalah hasil product antara nilai brightness citra X dan Y Y besaran skalar: nilai brightness Z proporsional terhadap X pada nilai Y Pembagian Y citra: Z adalah nilai skala brightness pada tiap pixel di X terhadap tiap pixel di Y Y besaran skalar: nilai brightness Z akan proportional terbalik terhadap X dengan nilai Y

IF-UTAMA

Operasi Boolean
Operasi boolean AND, OR, NOT Kombinasinya : NAND, NOR, XOR

Operasi Geometri
Proses yang memanipulasi posisi spatial dari pixel Contoh: Zoom (in & out) Rotasi Flipping Cut & paste Warping

Zoom
Proses-proses yang melibatkan penaikan atau penurunan ukuran citra Teknik yang paling sederhana dalam zooming menduplikasikan nilai pixel pada arah X atau Y. Jika citra tidak di zoom dengan nilai yang sama, maka aspect ratio dari citra akan berubah.

Aspect Ratio
Rasio antara jumlah titik vertikal dan horizontal untuk mendapatkan panjang yang sama di kedua arah tersebut

IF-UTAMA

Zoom in
Resolusi tidak bertambah Perubahan pada besar pixelnya titik kecil dapat terlihat lebih besar
Zoom 3x AR = 1

Contoh algoritma zoom 2x, AR = 1


int i,j,m,n; m=0; n=0; for (i=0;i<=jmlbaris-1;i++) { for(j=0;j<=jmlkolom-1;j++) { Z[m,n] = X[i,j]; Z[m,n+1] = X[i,j]; Z[m+1,n] = X[i,j]; Z[m+1,n+1] = X[i,j]; n=n+2; } m=m+2; n=0; }

Zoom 3x AR 1

Zoom out
Ada informasi pada citra yang harus dihilangkan. Salah satu metode sederhana ambil ratarata dari n pixel bertetangga pada X sebagai nilai dari satu pixel pada Z Contoh: hasil rata-ratanya 4 pixel pada X menjadi 1 pixel pada Z
Zoom 2x

Zoom in

reversible

Zoom 0.5x

IF-UTAMA

Zoom out

not reversible

Rotasi
Rotasi sederhana: kelipatan 900 salin pixel-pixel baris ke pixel-pixel kolom sesuai arah rotasi

Zoom 0.25x

Zoom 4x

Rotate 900

Rotate 900

Algoritma rotasi 900


int i,j,k; k=jmlkolom-1; for (i=0;i<=jmlbaris-1;i++) { for(j=0;j<=jmlkolom-1;j++) { Z[j,k] = X[i,j]; } k=k-1; }

Rotasi 0

Titik (a,b) (c,d), dimana : a = r.cos b = r.sin c = r.cos(+ ) = r.cos .cos r.sin .sin = a.cos b.sin d = r.sin(+ ) = r.sin .cos +r.cos .sin = b.cos + a.sin

IF-UTAMA

Rotasi X0 (contd)

Flipping

254 Rotasi 450 243 352

horizontal 352

vertikal

Di titik mana sebaiknya sumbu putaran? Bagaimana rumus umum mencari ukuran citra yang dirotasikan X0?

Algoritma flipping vertikal


int i,j,k; k=jmlbaris-1; for (i=0;i<=jmlbaris-1;i++) { for(j=0;j<=jmlkolom-1;j++) { Z[k,j] = X[i,j]; } k=k-1; }

Cut & Paste


Pemilihan (mulai paling mudah): Segiempat Bentuk geometri lain: lingkaran, elips, poligon Freeform

IF-UTAMA

Warping
Citra diubah dengan cara mengatur kembali hubungan spatial antara objek dengan suatu template spatial menimbulkan efek-efek khusus
Warp

Contoh warping

Point Operations
Point Operations are primarily used to change the perceived or viewed optical densities or colours and the perceived or viewed image contrast A point operation operates on individual pixels and does not take into account any neighbouring pixel values The same operation occurs on all of the pixels in the image

Point Operation Process


The process of the Point Operation is, starting at the top left of the image, to calculate the new (output) pixel value and place this at the same spatial location in a new (output) matrix of the same dimension as the original image. The process then moves to the pixel to the right and perform the operation until all pixels in the row have an output. The process then moves to the next row and continues until the entire image has an output.

IF-UTAMA

31

IF-UTAMA

32

IF-UTAMA

Point Operation Process


I(x,y)
0 1 2 3 4 5 6 7 8 0 152 3 234 141 241 45 127 162 64 102 213 227 1 120 114 72 214 154 95 98 81 123 189 235 103 2 22 199 65 169 141 65 137 83 130 174 219 192 3 215 134 17 134 231 127 149 189 100 35 137 243 4 34 88 145 85 145 123 67 69 58 169 22 102 4 1 20 185 234 236 94 45 195 226 203 195 220 6 0 60 235 237 35 47 52 94 214 243 168 187 117 199 181 68 27 166 29 171 34 135 208 21

Point Operation Process


The Point Operation process is denoted by: O(x,y) = M . I(x,y) where M is the mapping function or operation

Operation x 1.5

O(x,y)
0 1 0 255 180 1 2 3 4 5 6 7 8 2 3 4 4 6

IF-UTAMA

33

IF-UTAMA

34

Point Operations
The output of a point operations can be: a new image the new image O(x,y) will be the same size, rows and columns, and have the same bit depth, as the original image I(x,y) the displaying on stored image displayed contrast or brightness may or may not be altered compared to the original image values LUTs will typically be used to do this operation (some discussion earlier)

Gambaran Transformasi Citra

IF-UTAMA

35

IF-UTAMA

36

IF-UTAMA

Typical Types of Gray-level Transformation


UMCP ENEE631 Slides (created by M.Wu 2004)

Transformasi Citra

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

IF-UTAMA

37

IF-UTAMA

38

Mengubah Format kuantisasi

Konversi RGB ke Gray Scale

IF-UTAMA

39

IF-UTAMA

40

IF-UTAMA

10

Konversi Gray Scale ke Biner

Konversi Gray Scale ke m Bit

IF-UTAMA

41

IF-UTAMA

42

Pengaturan Brightness

Pengaturan Contrast

IF-UTAMA

43

IF-UTAMA

44

IF-UTAMA

11

Inversi

Negative Image

IF-UTAMA

45

IF-UTAMA

46

Example: Negative Transformation


UMCP ENEE631 Slides (created by M.Wu 2004)

Transformasi Logaritmik

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

IF-UTAMA

47

IF-UTAMA

48

IF-UTAMA

12

Contoh
Tranformasi Logaritmik
UMCP ENEE631 Slides (created by M.Wu 2004)

Example: Log Transformation

Transformasi Inverse Logaritmik

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

IF-UTAMA

49

IF-UTAMA

50

Transformasi Power Law

Contoh Hasil Transformasi power Law

IF-UTAMA

51

IF-UTAMA

52

IF-UTAMA

13

Gamma Characteristics & Gamma Correction


Non-linearity in CRT display Voltage U vs. Displayed luminance L L ~ U where = 2.0 ~ 2.5 Use preprocessing to compensate distortion U ~ L 1/ log(L) gives similar compensation curve to -correction good for many practical applications Camera may have L1/c capturing distortion with c = 1.0-1.7 Power-law transformations are also useful for general purpose contrast manipulation
IF-UTAMA

Example: Effects of Different Gammas


L0
UMCP ENEE631 Slides (created by M.Wu 2001)

L L = a U

UMCP ENEE631 Slides (created by M.Wu 2001/2004)

( vectors sample image from Matlab )

U U ~ logL ~L
1/

L02.2

L01/2.2

53

IF-UTAMA

54

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

Look-Up Table (LUT)


The LUT is a point operation that can have any mathematical calculation as its basis. Used for both display of the image and for creation of a new stored image LUTs are still constrained by the bit depth of the image ie, clipping and the output value must be an integer LUTs are used to improve performance of the operation.
UMCP ENEE631 Slides (created by M.Wu 2004)

IF-UTAMA

55

IF-UTAMA

56

IF-UTAMA

14

Look-Up Table (LUT)


Each operation is performed on each possible value within the image ie. in an 8 bit depth image, on the values 0, 1, 2, , 255. If the image has a spatial resolution of 1000 rows and columns, then the operation, without the use of LUTs, would have to be performed 1,000,000 times, rather than 256 times With LUTs, values still need to be looked-up but overall operation performance is improved.

Input Value 0 1 2 3 4 5 6 7 8 9 10 11 12

Operation Output Value x 1.5 0 x 1.5 2 x 1.5 3 x 1.5 5 x 1.5 6 x 1.5 8 x 1.5 9 x 1.5 11 x 1.5 12 x 1.5 14 x 1.5 15 x 1.5 17 x 1.5 18

Example of a LUT

Note: Output values are integers & between 0 and 255

IF-UTAMA

57

250 251 252 253 254 255

x x x x x x

1.5 1.5 1.5 1.5 1.5 1.5

255 255 255 255 255 255

IF-UTAMA

58

Referensi
1. Achmad Basuki, Pelatihan Image Processing dan Aplikasinya, Politeknik Elektronika Negeri Surabaya, 2005 Min Wu, Point Operations, ECE Department, Univ. of Maryland, College Park, 2004 http://csusap.csu.edu.au/~xzheng/lectures/mis 303/MIS303_5.ppt, Tanggal Akses : 29 April 2009

2. 3.

IF-UTAMA

59

IF-UTAMA

15