Anda di halaman 1dari 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 • Kuantisasi pada image
Danang Junaedi adalah banyaknya level
warna yang digunakan
untuk menyatakan dari
warna yang paling gelap
(hitam) sampai warna
yang paling terang sesuai
IF-UTAMA 1 satuan atau format warna
yang digunakan. IF-UTAMA 2

Digital Image Processing General Areas of Image Processing


• Function of Image Processing: to change • 3 general areas of digital image processing
– perceived / viewed image contrast
– perceived / viewed image colour – Point Operations
– perceived spatial information • Pixel Point Processing
– reduce image noise
– Local Operations
– change viewing conditions
– segmentation / pattern recognition • Pixel Group Processing
– Global Operations

IF-UTAMA 3 IF-UTAMA 4

IF-UTAMA 1
Basics of Digital Images (review) Point Operations / Intensity Transform
• Basic idea
• Digital images are a 2D array of values in rows and columns – “Zero memory” operation
given by I(x,y) (or some by I(c,r)) • each output only depend on the input intensity at the point
0 1 2 3 4 4 6 – Map a given gray or color level u to a new level v, i.e. v = f ( u )
0 152 120 22 215 34 1 0 117 – Doesn’t bring in new info.
1 3 114 199 134 88 20 60 199 – But can improve visual appearance or make features easier to
2 234 72 65 17 145 185 235 181 detect
3 141 214 169 134 85 234 237 68 • Example-1: Color coordinate transformations
4 241 154 141 231 145 236 35 27 – RGB of each pixel  luminance + chrominance components 
5 45 95 65 127 123 94 47 166 etc.
6 127 98 137 149 67 45 52 29 • Example-2: Scalar quantization
7 162 81 83 189 69 195 94 171 – quantize pixel luminance/color with fewer bits
v
8 64 123 130 100 58 226 214 34
102 189 174 35 169 203 243 135

output gray
213 235 219 137 22 195 168 208
227 103 192 243 102 220 187 21

level
input gray level u
IF-UTAMA 5 IF-UTAMA 6

Operasi Aljabar
• X opr Y = Z
– X: citra
– Y: citra atau besaran skalar
– Z: citra
Operasi-operasi Dasar Pengolahan Citra
Operasi Aljabar : Aritmatika & Boolean • Level komputasi:
Operasi Geometri – Berbasis titik (pointwise): dilakukan
antara tiap elemen X dan Y
– Berbasis matriks: melibatkan matriks
ketetanggaan

IF-UTAMA 2
Operasi Aritmatika Efek Penjumlahan pada Citra
• Beberapa operasi aritmatika: • Y citra:
– Penjumlahan – Z adalah jumlah nilai brightness dari tiap
pixel pada X dan Y
– Pengurangan
• Y besaran skalar:
– Perkalian – Z adalah versi yang lebih terang dari citra
– Pembagian X
– nilai kenaikan brightness sama dengan Y
Untuk citra RGB,
operasi dilakukan
per plane

Efek Perkalian & Pembagian


Efek Pengurangan pada Citra
pada Citra
• Y citra: • Perkalian
– Y citra:
– Z adalah perbedaan nilai brightness antar X
• Z adalah hasil product antara nilai brightness citra X
dan Y dan Y
• Y besaran skalar: – Y besaran skalar:
• nilai brightness Z proporsional terhadap X pada nilai Y
– Z adalah versi yang lebih gelap daripada X
• Pembagian
– nilai penurunan brightness sama dengan Y – 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 3
Operasi Boolean Operasi Geometri
• Operasi boolean  AND, OR, NOT • Proses yang memanipulasi posisi spatial
• Kombinasinya : NAND, NOR, XOR dari pixel
• Contoh:
– Zoom (in & out)
– Rotasi
– Flipping
– Cut & paste
– Warping

Zoom Aspect Ratio


• Proses-proses yang melibatkan penaikan • Rasio antara jumlah titik vertikal dan
atau penurunan ukuran citra horizontal untuk mendapatkan panjang yang
• Teknik yang paling sederhana dalam sama di kedua arah tersebut
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.

IF-UTAMA 4
Zoom in Contoh algoritma zoom 2x, AR = 1
• Resolusi tidak bertambah int i,j,m,n;
m=0;
• Perubahan pada besar n=0;
pixelnya for (i=0;i<=jmlbaris-1;i++)
– titik kecil dapat terlihat {
for(j=0;j<=jmlkolom-1;j++)
lebih besar
{
Z[m,n] = X[i,j];
Zoom 3x Z[m,n+1] = X[i,j];
AR = 1 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 Zoom in  reversible


• Ada informasi pada citra yang harus
dihilangkan.
• Salah satu metode sederhana  ambil rata-
rata 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 0.5x

IF-UTAMA 5
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 Rotasi β0


int i,j,k;
k=jmlkolom-1;
for (i=0;i<=jmlbaris-1;i++)
{ Titik (a,b)
(c,d), dimana :
for(j=0;j<=jmlkolom-1;j++) a = r.cos α
{ b = r.sin α
Z[j,k] = X[i,j]; c = r.cos(α+β)
} = r.cos α.cos β–r.sin α.sin β
k=k-1; = a.cos β – b.sin β
} d = r.sin(α+β)
= r.sin α.cos β+r.cos α.sin β
= b.cos β + a.sin β

IF-UTAMA 6
Rotasi X0 (cont’d) Flipping

horizontal
254
352
Rotasi
450

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

Algoritma flipping vertikal Cut & Paste


int i,j,k;
k=jmlbaris-1; • Pemilihan (mulai paling mudah):
for (i=0;i<=jmlbaris-1;i++) – Segiempat
{
for(j=0;j<=jmlkolom-1;j++) – Bentuk geometri lain: lingkaran, elips, poligon
{
Z[k,j] = X[i,j];
– Freeform
}
k=k-1;
}

IF-UTAMA 7
Warping Contoh warping
• Citra diubah dengan cara mengatur kembali
hubungan spatial antara objek dengan suatu
template spatial  menimbulkan efek-efek khusus

Warp

Point Operations Point Operation Process


• Point Operations are primarily used to change the • The process of the Point Operation is, starting at the top left
perceived or viewed optical densities or colours and of the image, to calculate the new (output) pixel value and
the perceived or viewed image contrast place this at the same spatial location in a new (output)
matrix of the same dimension as the original image.
• A point operation operates on individual pixels and • The process then moves to the pixel to the right and
does not take into account any neighbouring pixel perform the operation until all pixels in the row have an
values output.
• The same operation occurs on all of the pixels in the • The process then moves to the next row and continues until
image the entire image has an output.

IF-UTAMA 31 IF-UTAMA 32

IF-UTAMA 8
Point Operation Process Point Operation Process
I(x,y)
The Point Operation process is denoted by:
0 1 2 3 4 4 6 Operation
O(x,y) = M . I(x,y)
0 152 120 22 215 34 1 0 117 x 1.5
1 3 114 199 134 88 20 60 199 where M is the mapping function or operation
2 234 72 65 17 145 185 235 181
3 141 214 169 134 85 234 237 68
O(x,y)
4 241 154 141 231 145 236 35 27 0 1 2 3 4 4 6
5 45 95 65 127 123 94 47 166 0 255 180
6 127 98 137 149 67 45 52 29 1
7 162 81 83 189 69 195 94 171 2
8 64 123 130 100 58 226 214 34 3
102 189 174 35 169 203 243 135 4
213 235 219 137 22 195 168 208 5
227 103 192 243 102 220 187 21 6
7
8

IF-UTAMA 33 IF-UTAMA 34

Point Operations Gambaran Transformasi Citra


• 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)

IF-UTAMA 35 IF-UTAMA 36

IF-UTAMA 9
Typical Types of Gray-level
Transformasi Citra
Transformation
UMCP ENEE631 Slides (created by M.Wu © 2004)

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 Transformasi Logaritmik


UMCP ENEE631 Slides (created by M.Wu © 2004)

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

IF-UTAMA 47 IF-UTAMA 48

IF-UTAMA 12
Contoh Example: Log Transformation
• Tranformasi Logaritmik

UMCP ENEE631 Slides (created by M.Wu © 2004)


• 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 Example: Effects of Different Gammas
• Non-linearity in CRT display L’ L0
UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

γ
– Voltage U vs. Displayed luminance L’

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


L’ = a U
( “vectors” sample image
γ
• L’ ~ U where γ = 2.0 ~ 2.5 from Matlab )
• Use preprocessing to compensate γ-
U
distortion
– U ~ L 1/ γ L01/2.2
U ~ logL
L02.2
– log(L) gives similar compensation 1/γ
~L
curve to γ-correction
• good for many practical
applications
L
– 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 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
UMCP ENEE631 Slides (created by M.Wu © 2004)

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
• LUT’s are used to improve performance of
the operation.

IF-UTAMA 55 IF-UTAMA 56

IF-UTAMA 14
Input Operation Output
Look-Up Table (LUT) Value
0 x 1.5
Value
0
Example of a LUT
1 x 1.5 2
2 x 1.5 3
• Each operation is performed on each possible 3 x 1.5 5
value within the image ie. in an 8 bit depth 4 x 1.5 6
5 x 1.5 8
image, on the values 0, 1, 2, ………, 255. 6 x 1.5 9
7 x 1.5 11
• If the image has a spatial resolution of 1000 8 x 1.5 12 Note:
rows and columns, then the operation, without 9 x 1.5 14 Output values are
10 x 1.5 15
the use of LUT’s, would have to be performed 11 x 1.5 17
integers & between
1,000,000 times, rather than 256 times 12 x 1.5 18 0 and 255
• With LUT’s, values still need to be “looked-up”
but overall operation performance is improved.
250 x 1.5 255
251 x 1.5 255
252 x 1.5 255
253 x 1.5 255
254 x 1.5 255
IF-UTAMA 57 255 x 1.5 255 IF-UTAMA 58

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

IF-UTAMA 59

IF-UTAMA 15