Pertemuan 2 - PCD
Pertemuan 2 - PCD
Grafika Komputer
Computer Vision
Catatan :
8 bit warna graysacle = 256 warna, variasi warna
0,1,2,3,......255.
90 80 120 128 80
(1,1 (1,2) (1,3) (1,4) (1,5)
)
100 81 180 80 100
(2,1 (2,2) (2,3) (2,4) (2,5)
)
0 20 40 0 8
(3,1 (3,2) (3,3) (3,4) (3,5)
)
90 180 255 100 80 A(x,y)
(4,1 (4,2) (4,3) (4,4) (4,5)
R=90
) 80 120 128 0
G=10 100 20 20 200
0 0 100 50 80
B=0 (1,2) (1,3 (1,4) (1,5)
(1,1) )
B(x,y)
Contoh: (4,1)
1. Transformasi Citra Warna ke Graysacle Ain(x,y)
Penyelesaian :
F out ( 1,1 )=¿ ¿
90+ 80+70
F out ( 1,1 )= = 80
3
2. Transformasi Grayscale ke Biner
30 0 80 120 10
(1,1) (1,2) (1,3) (1,4) (1,5)
20 30 80 20 60
(2,1) (2,2) (2,3) (2,4) (2,5)
90 20 10 40 60
(3,1) (3,2) (3,3) (3,4) (3,5)
90 80 100 60 100
(4,1) (4,2) (4,3) (4,4) (4,5)
B(x,y)
Diketahui :
Fin max = 120
Fin min = 0
Penyelesaian :
T = 120 + 0 = 120 = 60
2 2
Fout (1,1) =
3. Kecerahan (Brightness)
Subimage citra grayscale C(x,y) dilakukan peningkatan kualitas citra menggunakan operasi kecerahan (brightness) dengan konstanta kecerahan = 2. Maka tentukan matrik
citra hasilnya !
30 0 80 120 10
(1,1) (1,2) (1,3) (1,4) (1,5)
20 30 80 20 60 Maka, matrik output citra C(x,y) adalah sbb :
(2,1) (2,2) (2,3) (2,4) (2,5)
90 20 10 40 60
(3,1) (3,2) (3,3) (3,4) (3,5)
90 80 100 60 254
(4,1) (4,2) (4,3) (4,4) (4,5)
C(x,y)
Diketahui :
k=2
Penyelesaiannya :
Fout (1,1)= 30 + 2 = 32
Fout (1,2)= 0 + 2 = 2
Contoh :
Subimage citra grayscale D(x,y) dilakukan peningkatan kualitas citra menggunakan operasi kontras. Maka tentukan matrik citra hasilnya !
Diketahui :
Fmax = 255
Fin max = 254
Penyelesaian :
Contoh :
Subimage citra grayscale E(x,y) dilakukan operasi invers. Maka tentukan matrik citra hasilnya !
Diketahui :
Fmax = 255
Penyelesaian :
Fout (1,1)= 255 – 30 = 225
Fout (1,2)= 255 – 0 = 225
Fout (1,3)= 255 – 80 =
Pertemuan 4 :
1) Filter Maksimum
Penyelesaikan :
10 15 20 5 4 3 2 1 0 10
6 7 4 3 6 2 7 9 0 3
2 1 5 2 7 9 0 4 7 36
6 5 1 0 5 2 8 5 7 5
9 2 3 6 2 6 9 0 1 4
8 4 7 3 9 7 5 3 1 0
6 3 6 8 0 2 4 6 5 2
2 8 5 3 8 9 0 10 3 6
A(x,y)
0 0 0 0 0 0 0 0 0 0 0 0
0 10 15 20 5 4 3 2 1 0 10 0
(1,1 (1,2) (1,3 (1,4) (1,5 (1,6) (1,7 (1,8) (1,9) (1,10)
) ) ) )
0 6 7 4 3 6 2 7 9 0 3 0
(2,2
)
0 2 1 5 2 7 9 0 4 7 36 0
0 6 5 1 0 5 2 8 5 7 5 0
0 9 2 3 6 2 6 9 0 1 4 0
0 8 4 7 3 9 7 5 3 1 0 0
0 6 3 6 8 0 2 4 6 5 2 0
0 2 8 5 3 8 9 0 10 3 6 0
0 0 0 0 0 0 0 0 0 0 0 0
Misal filter yang diminta adalah 5x5, maka analisisnya adalah sbb :
Fout (1,1)=0,0,0,0,0,0,0,0,0,0,1,1,2,2,3,4,5,5,5,6,6,7,10,15,20 = 20
Fout (8,10)=0,0,0,0,0,2,3,5,6
Maka, Citra Hasilnya adalah sbb :
15 20 20
(1,1 (1,2 (1,3
) ) )
Penyelesaian :
1. Teknik Zero Padding
0 0 0 0 0 0 0 0 0 0 0 0
0 5 3 3 0 4 4 0 5 2 2 0
0 4 2 1 3 4 0 5 1 3 3 0
0 6 3 0 1 6 2 3 0 7 0 0
0 7 4 0 1 2 3 2 0 7 0 0
0 7 4 5 1 0 6 3 2 7 0 0
0 7 4 5 5 7 7 6 2 6 4 0
0 6 0 1 4 7 0 7 2 0 2 0
0 6 5 1 3 2 4 4 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
A(x,y)
Fout (1,1)= ( 1 x 0) + ( 0 x 0) + ( 1 x 0) +
( 0 x 0) + ( 2 x 5) + ( 0 x 3) +
(-1 x 0) + ( 0 x 4) + (-2 x 2)
= 10 – 4 = 6
Fout (1,2)= ( 1 x 0) + ( 0 x 0) + ( 1 x 0) +
( 0 x 5) + ( 2 x 3) + ( 0 x 3) +
(-1 x 4) + ( 0 x 2) + (-2 x 1)
= 6 -4 -2 = 0
5 3 3 0 4 4 0 5 2 2
4 2 1 3 4 0 5 1 3 3
6 3 0 1 6 2 3 0 7 0
7 4 0 1 2 3 2 0 7 0
7 4 5 1 0 6 3 2 7 0
7 4 5 5 7 7 6 2 6 4
6 0 1 4 7 0 7 2 0 2
6 5 1 3 2 4 4 1 0 0
A(x,y)
Penyelesaian :
Fout (2,2)= ( 1 x 5) + ( 0 x 3) + ( 1 x 3) +
( 0 x 4) + ( 2 x 2) + ( 0 x 1) +
(-1 x 6) + ( 0 x 3) + (-2 x 0)
= 5 +3 +4 - 6 = 6
Maka, matrik citra output :
5 3 3 0 4 4 0 5 2 2
(1,1
)
4 6 3
(2,1 (2,2
) )
6 0
7 0
7 0
7 4
6 2
6 5 1 3 2 4 4 1 0 0
Pertemuan 5
1) Penajaman Citra
g(x,y)
Contoh Soal !
Subimage grayscale A(x,y) dilakukan segementasi citra dengan menggunakan filter Laplacian dengan derajat penajaman adalah 2. Maka
tentukan matrik citra hasilnya !
10 6 8 5 2 Diketahui :
2 1 3 8 1 α =2
0 2 4 5 1 0 -2 0
10 2 8 5 2 -2 9 -2
5 5 6 8 9 0 -2 0
A(x,y) g(x,y)
Penyelesaian :
Fout(2,2) = ( 0 x 10) + (-2 x 6 ) + ( 0 x 8 ) + Fout(2,3) = ( 0 x 6 ) + (-2 x 8) + ( 0 x 5) +
(-2 x 2 ) + ( 9 x 1 ) + (-2 x 3 ) + (-2 x 1) + ( 9 x 3) + (-2 x 8) +
( 0 x 0 ) + ( -2 x 2 ) + ( 0 x 4 ) ( 0 x 2) + (-2 x 4) + ( 0 x 5)
= -12 – 4 + 9 -6 -4 = 0 = -16-2+27-16-8 = 0
Latihan !
Subimage grayscale A(x,y) dilakukan peningkatan kualitas citra dengan menggunakan filter emboss dari arah kiri dan emboss dari arah kanan
atas dengan derajat emboss adalah 2. Maka tentukan matrik untuk masing-masing citra hasilnya !
10 6 8 5 2
2 1 3 8 1
0 2 4 5 1
10 2 8 5 2
5 5 6 8 9
A(x,y)
Pertemuan 6 :
Contoh Soal !
Subimage citra grayscale A(x,y) dilakukan pencerminan berdasarkan sumbu y, maka tentukan matrik citra hasilnya !
10 5 6 8 2
4 5 6 1 2
0 6 7 8 5
5 1 2 4 2
9 6 9 5 3
A(x,y)
Diketahui :
W=5
Penyelesain :
Fout(1,1) => x1’=5-1+1=5 =>(5,1) Fout(2,1) => x2’=5-2+1=5 =>(4,1) Fout(3,1) => x3’=5-3+1=5 =>(3,1)
Fout(1,2) => x1’=5-1+1=5 =>(5,2) Fout(2,2) => x2’=5-2+1=5 =>(4,2) Fout(3,2) => x3’=5-3+1=5 =>(3,2)
Fout(1,3) => x1’=5-1+1=5 =>(5,3) Fout(2,3) => x2’=5-2+1=5 =>(4,3) Fout(3,3) => x3’=5-3+1=5 =>(3,3)
Fout(1,4) => x1’=5-1+1=5 =>(5,4) Fout(2,4) => x2’=5-2+1=5 =>(4,4) Fout(3,4) => x3’=5-3+1=5 =>(3,4)
Fout(1,5) => x1’=5-1+1=5 =>(5,5) Fout(2,5) => x2’=5-2+1=5 =>(4,5) Fout(3,5) => x3’=5-3+1=5 =>(3,5)
Horizontal :
10 10 5 5 6 6 8 8 2 2
4 4 5 5 6 6 1 1 2 2
0 0 6 6 7 7 8 8 5 5
5 5 1 1 2 2 4 4 2 2
9 9 6 6 9 9 5 5 3 3
Interpolasi :
Kh=2 (Interpolasi)
1 3 5 7 9
3 3 3 9 11
5 3 5 7 9
7 5 5 5 7
9 7 9 11 11
1 2 3 4 5 6 7 8 9 9
3 3 3 3 3 6 9 10 11 11
5 4 3 4 5 6 7 8 9 9
7 6 5 5 5 5 5 6 7 7
9 8 7 8 9 10 11 11 11 11
Transponse :
1 3 5 7 9
3 3 3 9 11
5 3 5 7 9
7 5 5 5 7
9 7 9 11 11
Aout (x,y)
Maka, matriks hasilnya adalah sbb :
Pertemuan 7 :
1) Image Blending
Contoh :
Subimage citra grayscale masing-masing adalah A(x,y) dan B(x,y) akan dilakukan penjumlahan citra dengan bobot citra A adalah 0,3. Maka
tentukan matrik citra hasilnya !
10 100 40 0 30 10 50 30 80 10
60 50 50 20 40 30 30 20 70 20
40 30 30 20 20 10 20 80 50 30
50 20 20 10 10 20 10 90 40 20
30 10 0 50 0 0 10 100 30 90
A(x,y) B(x,y)
Penyelesaian :
Diketahui : WA= 0,3, maka WB = 1-0,3 =0,7
10 100 40 0 30 0
60 50 50 20 40 60 60 50 20 40
40 30 30 20 20 40 30 30 20 20
50 20 20 10 10 50 20 10 10 10
30 10 0 50 0 30 10 10 50 0
A(x,y) B(x,y)
10 100 40 0 30
Penyelesaian :
Penyelesaian :
3. Operasi Bolean
Contoh :
1 1 0 0 1 0 1 1 1 0
0 1 1 0 0 1 1 0 1 0
0 0 1 1 0 0 1 1 1 1
1 1 0 1 0 0 1 0 1 1
0 1 1 1 0 1 0 1 1 1
A(x,y) B(x,y)