zulkaryanto.files.wordpress.com example of the variable-length coding is huffman coding 1. Coding...
Transcript of zulkaryanto.files.wordpress.com example of the variable-length coding is huffman coding 1. Coding...
1
1
Edge Detection
Yeni Herdiyeni
Departemen Ilmu Komputer FMIPA IPB
2
Outline
Introduction
Image Segmentation
Edge detection method
Differentiation (Gradient Operator)
Hough Transform
Reference
2
3
What are edges?
Edge detection
Local intensity change
Strong edge = the steep areas in a 3D plot (show: blobs-for-edge, surface plot)
4
What are edges?
3
Deteksi Tepi
Deteksi tepi (Edge detection) adalah operasi yang dijalankan untuk mendeteksi garis tepi (edges) atau boundary untuk segmentasi, registrasi, dan identifikasi objek.
Edge adalah beberapa bagian dari citra di mana intensitas kecerahan berubah secara drastis.
5
Deteksi Tepi (edge)
Edge adalah beberapa bagian dari citra di mana intensitas kecerahan berubah secara drastis.
Dalam objek berdimensi 1, perubahan dapat diukur dengan menggunakan fungsi turunan (derivative function).
Perubahan mencapai maksimum pada saat nilai turunannya pertamanya mencapai nilai maksimum atau nilai turunan kedua (2nd derivative) bernilai 0.
6
4
7
Gradient Operators
Motivasi: mendeteksi perubahan changes
Perubahan nilai piksel yang besar Gradient besar
Gradient
operatorimage Thresholding
edge
mapx(m,n)
g(m,n)I(m,n)
otherwise
thnmgnmI
0
|),(|1),(
MATLAB function: > help edge
8
Introduction
Fig.1. Edges are boundaries between different textures.Edge also can be defined as
discontinuities inimage intensity from one pixel to another.. [4]
5
9
EDGE DETECTION METHOD
First-Order Derivative Edge Detection The Roberts operators
The Prewitt operators
The Sobel operators
First-Order of Gausssian (FDOG)
Second-Order Derivative Edge Detection Laplacian
Canny
10
Edge Detectors
Mudah diimplementasikan dan cepat
Berdasarkan grey-level gradient
Dihitung pada setiap piksel => Gradient image: g(x,y)
Menggunakan 16-bit atau 32-bit image untuk merepresentasikan gradient!
Gradient : the first-order derivative:
Bekerja pada arah x dan y:
)1,()1,(),(
),1(),1(),(
yxfyxfyxg
yxfyxfyxg
y
x
),(),( yxgyxf
6
Correlation with this kernel: -1 +1
Normally this kernel to avoid bias:
12
Fist-Order Derivative Edge Detection
x
y
fG xf
fG
x
2 2| | x yf f G G
the direction of the gradient vector
the gradient vector
the magnitude of this vector
Definition:
1 of tany
x
Gangle f
G
7
13
Fist-Order Derivative Edge Detection
Fig.2. Orthogonal gradient generation.[2]
The gradient along the line normal to the edge slope
The spatial gradient amplitude
The gradient amplitude combination
14
The Roberts operators
8
15
The Prewitt operators
16
The Sobel operators
3 6 9 1 4 7( ) ( )yG z z z z z z
9
17
Operators
Fig.3. Impulse response arrays for 3 3 orthogonal
differential gradient edge operators.[2]
18
First-Order of Gausssian
( , ) * ( , )
( , ) * ( , )
x x
y y
M x y G I x y
M x y G I x y
It is hard to find the gradient by using the equation
In order to simplify the computation
M=|Mx|+|My|
10
19
First-order derivative edge detection
Fig.4. Using 1st-order differentiation to detect (a) the sharp edges, (c) the step edges with noise, and (e) the ramp edges. (b)(d)(e) are the results of differentiation of (a)(c)(e).[3]
Second Order Derivation
Laplacian
20
11
21
Second-order derivative edge detection
The Laplacian of a 2-D function f (x, y) is a second-order derivative defined as:
2 22
2 2
f ff
x y
22
Edge Detector: Laplacian
Where exactly is the edge (width)?
Second-order derivative:
The variation of the variation of the gray-level value!
How fast does the gradient change?
Find the zero-crossing
Center of edge
),('' yxf
0Zero-crossing
Prewitt and Sobel0 -1 0
-1 4 -1
0 -1 0
),('' yxf
12
23
24
Second-order derivative edge detection
2 2
22( , )
x y
h x y e
2
22 2 2
2 24
2( , )
rx y
h x y e
The 2-D Gaussian function:
The Laplacian of Gaussian (LOG):
13
25
Second-order derivative edge detection
Fig.7. An 1111 mask approximation to Laplacian of Gaussian (LOG).[3]
26
Second-order derivative edge detection
Sensitive to noise
Gaussian function
Low-pass filter
14
27
Second-order derivative edge detection
(a) Original image.
(b) Laplacian mask of Fig.(a)
(c) Laplacian mask of Fig.(b)
(d) LOG mask of Fig.(b)
(a)
(b)
(c)
(d)
Fig.9. Simulation of second-order of derivative edge detection[3]
28
Second-order derivative edge detection
Fig.10. Using 1st-order differentiation to detect (a) the sharp edges, (c) the step edges with noise, and (e) the ramp edges. (b)(d)(e) are the results of differentiation of (a)(c)(e).[3]
15
29
Second-order derivative edge detection
The Drawbacks of the Differentiation
Method for Edge Detection :
Sensitivity to noise
Not good for ramp edges
Make no difference between the significant edge and the detailed edge
30
Edge Detector: Laplacian
Noise reduction
2D Gaussian used for smoothing
Edge enhancement
Second-order derivative (second-order gradient)
Edge localisation
Zero-crossings
16
31
Edge Detector: Laplacian
The second-order derivative is very sensitive to noise!
Second Order Derivation
Canny
32
17
33
Canny Edge Detector
Noise reduction
2D Gaussian used for smoothing
Edge enhancement
Magnitude of gradient vector:
Edge localisation
Complicated
yxyx ggggg22
34
Canny Edge Detector
Edge localisation
Wide edges:
Edges give rise to ridges in the gradient image
Thin edges using the principle of non-maximal suppression
Find gradients directions
Each pixel is compared with its two
neighbors in the gradient direction. The
two smallest are suppressed => set to zero
The result is pixel-thin edges
18
35
Canny Edge Detection
Good detection
Good localization
Single response Many edge candidate
The accurate edge
36
Simulation
The original image
The Sobel operatorsFDOG
Fig.5. Comparison with FDOG and the Sobel operators
19
37
Simulation
(a) Original image.
(b) Roberts operator.
(c) Prewitt operator.
(d) Sobel operator.
(a)
(b)
(c)
(d)
Fig.6. Simulation of first-order of derivative edge detection[3]
38
Second-order derivative edge detection
2
5 2 4 6 84 ( )f z z z z z2
5 1 2 3 4 6 7 8 98 ( )f z z z z z z z z z
20
39
Conlusion
Fist-Order Derivative Edge Detection:
the simplest method
Second-Order Derivative Edge Detection:
sensitive to noise
40
Reference
[1] Soo-Chang Pei, Jian-Jiun Ding, Imporved Harris AlgotithmForConer And Edge Detections, vol 1, 2005.
[2] William K. Pratt , Digital Image Processing_William K. Pratt3rd ,chapter 15.
[3] Jiun-De Huang, Image Compression by Segmentation andBoundary Description, chapter 2.
[4] J. Canny, A Computational Approach to Edge Detection, IEEETrans. Pattern Analysis and Machine Intelligence, PAMI-8,6,November 1986, 679698.
21
41
END
Kuliah 10 Deteksi Tepi Canny edit print.pdf
1
Deteksi Tepi Canny
Yeni Herdiyeni
Departemen Ilmu Komputer IPB
Canny Edge Detector 1
Edge Detection Method
The First Derivative - Gradient: The gradient method
detects the edges by looking for the maximum and minimum
in the first derivative of the image.
The Second Derivatives - Laplacian: The Laplacian method
searches for zero crossings in the second derivative of the
image to find edges. An edge has the one-dimensional shape
of a ramp and calculating the derivative of the image can
highlight its location.
Canny Edge Detector 2
Canny Edge Detector 3 Canny Edge Detector 4
Deteksi Tepi (edge)
Perubahan mencapai maksimum pada
saat nilai turunannya pertamanya
mencapai nilai maksimum atau nilai
turunan kedua (2nd derivative) bernilai
0.
5
The Canny edge detector
original image (Lena)
2
The Canny edge detector
Gradient magnitude
The Canny edge detector
thresholding
The Canny edge detector
thinning
(non-maximum suppression)
Canny Edge Detection
Steps
1. Doing Convolution :Apply derivative of Gaussian (to
compute Gradient Magnitude)
2. Non-maximum suppression
Thin multi-pixel wide ridges down to single pixel
3. Thresholding
Low, high edge-strength thresholds
Accept all edges over low threshold that are connected to edge
over high threshold
Matlab: edge(I, canny)
Canny Edge Detector 11
Gradient
At each point convolve with
Sobel also can be applied to compute gradient
magnitude and orientation of the Gradient are computed as
Avoid floating point arithmetic for fast computation
11
11xG
11
11yG
22 ],[],[],[ jiQjiPjiM
]),[],,[(tan],[ 1 jiPjiQji
Sobel Edge Detector
Detecting Edges in Image
Image I
101
202
101
121
000
121
*
*
Idx
d
Idy
d
22
Idy
dI
dx
d
ThresholdEdges
3
Teknik Konvolusi
Canny Edge Detector 13
Example:
Non-Maximum Suppression
courtesy of G. Loy
Original image Gradient magnitudeNon-maxima suppressed
Edge Smearing
from Forsyth & Ponce
0
0
0
0
2
2
2
2
20
20
20
20
2
2
2
2
Sobel filter example: Yields2-pixel wide edge band
We want to localize the edge to within 1 pixel
6
8
8
6
6
8
8
6
00
00
00
00
-8
-6
-6
-8
Input
Result
Canny Edge Detector 16
Non-Maxima Suppression
Thin edges by keeping large values of Gradient
not always at the location of an edge
there are many thick edges
12010232
10100232
01001230
00112310
01121200
13121000
31110000
Canny Edge Detector 17
Non-Maxima Suppression (2)
Thin the broad ridges in M[i,j] into ridges that are only one pixel wide
Find local maxima in M[i,j] by suppressing all values along the line of the Gradient that are not peak values of the ridge
12010232
10100232
31001230
00112310
01121200
13121003
31110000
gaps
false
edges
Edge Streaking
Can predict next pixel in edge orthogonal to gradient to make edge chain Can also just use 8-connectedness to define chains
Streaking: Gaps in edge chain due to edge strength dipping below threshold
courtesy of G. Loy
Original image Strong edges
gap
4
Example: Canny Edge Detection
courtesy of G. Loy
gap is gone
Originalimage
Strongedges
only
Strong +connectedweak edges
Weakedges
Non-Maximum Suppression
Suppress the pixels in Gradient Magnitude
Image which are not local maximum
edgean tonormaldirection thealong
in of neighbors theare and Sx,yy,xy,x
otherwise0
,,&
,, if,
, yxSyxS
yxSyxSyxS
yxMyx ,
yx,
yx ,
Canny Edge Detector 21
Gradient Orientation
Reduce angle of Gradient [i,j] to one of the 4 sectors
Check the 3x3 region of each M[i,j]
If the value at the center is not greater than the 2
values along the gradient, then M[i,j] is set to 0
Canny Edge Detector 22
local
maxima
removed
depends
on condition
12010232
10100232
01001230
00112310
01121200
13121000
31110000
Canny Edge Detector 23
The suppressed magnitude image will contain many
false edges caused by noise or fine texture
02010030
10100030
00000230
00000300
00021200
03120000
30000000
false edges
Canny Edge Detector 24
Thresholding
Reduce number of false edges by applying a
threshold T
all values below T are changed to 0
selecting a good values for T is difficult
some false edges will remain if T is too low
some edges will disappear if T is too high
some edges will disappear due to softening of the
edge contrast by shadows
5
Canny Edge Detector 25
Double Thresholding
Apply two thresholds in the suppressed image
T2 = 2T2
two images in the output
the image from T2 contains fewer edges but has gaps in the
contours
the image from T1 has many false edges
combine the results from T1 and T2
link the edges of T2 into contours until we reach a gap
link the edge from T2 with edge pixels from a T1 contour
until a T2 edge is found again
Canny Edge Detector 26
T2=2 T1=1
02000030
00000030
00000230
00000300
00020200
03020000
30000000
02010030
10100030
00000230
00000300
00021200
03120000
30000000
gaps
filled
from
T1
A T2 contour has pixels along the green arrows
Linking: search in a 3x3 of each pixel and connect the
pixel at the center with the one having greater value
Search in the direction of the edge (direction of Gradient)
Canny Edge Detector 27
Line Detection
Model of a line: two edges with opposite polarity in distance less than the size of the smoothing filter
edge detection filters respond to step edges
they do not provide meaningful response to lines
Apply nonmaxima suppression on the smoothed output
a line is the derivative of a step the derivative step of the Canny algorithm is not necessary
Tugas
Buat program deteksi tepi Canny
menggunakan matlab, tidak boleh
menggunakan fungsi dari matlab : edge(I,
canny)
Sertakan penjelasan teori dan kode
programnya pada laporan terpisah dengan
kode program (*baca referensi yang diberikan)
Tugas dikumpulkan tgl 4 Desember 2009
Canny Edge Detector 28
Kuliah 10 Deteksi Tepi Canny.pdf
Euripides G.M. Petrakis 1
Deteksi Tepi Canny
Yeni Herdiyeni
Departemen Ilmu Komputer IPB
Canny Edge Detector 1
The Canny edge detector
original image (Lena)
Euripides G.M. Petrakis 2
The Canny edge detector
Gradient magnitude
The Canny edge detector
thresholding
Euripides G.M. Petrakis 3
The Canny edge detector
thinning
(non-maximum suppression)
Sobel Edge Detector
Detecting Edges in Image
Image I
101
202
101
121
000
121
*
*
Idx
d
Idy
d
22
Idy
dI
dx
d
ThresholdEdges
Euripides G.M. Petrakis 4
Canny Edge Detector
xS
yS
I
Canny Edge Detector
I
22
yx SSS
25ThresholdS
Euripides G.M. Petrakis 5
Canny Edge Detection
Steps
1. Apply derivative of Gaussian : Gradient Magnitude
2. Non-maximum suppression
Thin multi-pixel wide ridges down to single pixel
3. Thresholding
Low, high edge-strength thresholds
Accept all edges over low threshold that are connected to edge
over high threshold
Matlab: edge(I, canny)
Canny Edge Detector 10
Canny Edge Detector
1) Smooth image with a Gaussian
optimizes the trade-off between noise filtering and edge localization
2) Compute the Gradient magnitude using approximations of partial derivatives
2x2 filters
3) Thin edges by applying non-maxima suppression to the gradient magnitude
4) Detect edges by double thresholding
Euripides G.M. Petrakis 6
Canny Edge Detector 11
Gradient
At each point convolve with
magnitude and orientation of the Gradient are computed as
Avoid floating point arithmetic for fast computation
11
11xG
11
11yG
22 ],[],[],[ jiQjiPjiM
]),[],,[(tan],[ 1 jiPjiQji
Example:
Non-Maximum Suppression
courtesy of G. Loy
Original image Gradient magnitudeNon-maxima suppressed
Euripides G.M. Petrakis 7
Edge Smearing
from Forsyth & Ponce
0
0
0
0
2
2
2
2
20
20
20
20
2
2
2
2
Sobel filter example: Yields2-pixel wide edge band
We want to localize the edge to within 1 pixel
6
8
8
6
6
8
8
6
00
00
00
00
-8
-6
-6
-8
Input
Result
Canny Edge Detector 14
Non-Maxima Suppression
Thin edges by keeping large values of Gradient
not always at the location of an edge
there are many thick edges
12010232
10100232
01001230
00112310
01121200
13121000
31110000
Euripides G.M. Petrakis 8
Canny Edge Detector 15
Non-Maxima Suppression (2)
Thin the broad ridges in M[i,j] into ridges that are only one pixel wide
Find local maxima in M[i,j] by suppressing all values along the line of the Gradient that are not peak values of the ridge
12010232
10100232
31001230
00112310
01121200
13121003
31110000
gaps
false
edges
Edge Streaking
Can predict next pixel in edge orthogonal to gradient to make edge chain Can also just use 8-connectedness to define chains
Streaking: Gaps in edge chain due to edge strength dipping below threshold
courtesy of G. Loy
Original image Strong edges
gap
Euripides G.M. Petrakis 9
Example: Canny Edge Detection
courtesy of G. Loy
gap is gone
Originalimage
Strongedges
only
Strong +connectedweak edges
Weakedges
Non-Maximum Suppression
Suppress the pixels in Gradient Magnitude
Image which are not local maximum
edgean tonormaldirection thealong
in of neighbors theare and Sx,yy,xy,x
otherwise0
,,&
,, if,
, yxSyxS
yxSyxSyxS
yxMyx ,
yx,
yx ,
Euripides G.M. Petrakis 10
Canny Edge Detector 19
Gradient Orientation
Reduce angle of Gradient [i,j] to one of the 4 sectors
Check the 3x3 region of each M[i,j]
If the value at the center is not greater than the 2
values along the gradient, then M[i,j] is set to 0
Canny Edge Detector 20
local
maxima
removed
depends
on condition
12010232
10100232
01001230
00112310
01121200
13121000
31110000
Euripides G.M. Petrakis 11
Canny Edge Detector 21
The suppressed magnitude image will contain many
false edges caused by noise or fine texture
02010030
10100030
00000230
00000300
00021200
03120000
30000000
false edges
Canny Edge Detector 22
Thresholding
Reduce number of false edges by applying a
threshold T
all values below T are changed to 0
selecting a good values for T is difficult
some false edges will remain if T is too low
some edges will disappear if T is too high
some edges will disappear due to softening of the
edge contrast by shadows
Euripides G.M. Petrakis 12
Canny Edge Detector 23
Double Thresholding
Apply two thresholds in the suppressed image
T2 = 2T2
two images in the output
the image from T2 contains fewer edges but has gaps in the
contours
the image from T1 has many false edges
combine the results from T1 and T2
link the edges of T2 into contours until we reach a gap
link the edge from T2 with edge pixels from a T1 contour
until a T2 edge is found again
Canny Edge Detector 24
T2=2 T1=1
02000030
00000030
00000230
00000300
00020200
03020000
30000000
02010030
10100030
00000230
00000300
00021200
03120000
30000000
gaps
filled
from
T1
A T2 contour has pixels along the green arrows
Linking: search in a 3x3 of each pixel and connect the
pixel at the center with the one having greater value
Search in the direction of the edge (direction of Gradient)
Euripides G.M. Petrakis 13
Canny Edge Detector 25
Line Detection
Model of a line: two edges with opposite polarity in distance less than the size of the smoothing filter
edge detection filters respond to step edges
they do not provide meaningful response to lines
Apply nonmaxima suppression on the smoothed output
a line is the derivative of a step the derivative step of the Canny algorithm is not necessary
Tugas
Buat program deteksi tepi Canny
menggunakan matlab, tidak bolehmenggunakan fungsi dari matlab : edge(I,
canny)
Sertakan penjelasan programnya pada laporan
terpisah dengan kode program
Tugas dikumpulkan tgl 18 Desember 2008
Canny Edge Detector 26
Kuliah 13 Kompresi Citra 2 yhy.pptx
KOMPRESI CITRA
Yeni Herdiyeni
Departmen Ilmu Komputer IPB
Kompresi Citra
Kompresi Citra adalah aplikasi kompresi data yang dilakukan terhadap citra digital dengan tujuan untuk mengurangi redundansi dari data-data yang terdapat dalam citra sehingga dapat disimpan atau ditransmisikan secara efisien.
Teknik Kompresi Citra (4)
Loseless Compression :
Teknik kompresi citra dimana tidak ada satupun informasi citra yang dihilangkan.
Biasa digunakan pada citra medis.
Metode loseless : Run Length Encoding, Entropy Encoding (Huffman, Aritmatik), dan Adaptive Dictionary Based (LZW)
Contoh Citra Medik
Run Length Encoding (RLE)
Contoh 1
Citra biner:
0000000000000000000000010
0000000000010000000000000
Total = 50 bit
Kode string 0 dan 1 dikodekan menjadi
(format : kode(jumlah frekuensi)):
0(23) 1(1) 0(12) 1(1) 0(13)
Jika untuk menyimpan nilai jumlah frekuensi membutuhkan 5 bit untuk penyimpanan dan kode string membutuhkan 1 bit, maka diperlukan kapasitas sebesar : (1*5) + (5*5) = 30 bit.
Run Length Encoding (RLE)
Exercise
Teknik Kompresi Citra (1)
Lossy Compression :
Ukuran file citra menjadi lebih kecil dengan menghilangkan beberapa informasi dalam citra asli.
Teknik ini mengubah detail dan warna pada file citra menjadi lebih sederhana tanpa terlihat perbedaan yang mencolok dalam pandangan manusia, sehingga ukurannya menjadi lebih kecil.
Biasanya digunakan pada citra foto atau image lain yang tidak terlalu memerlukan detail citra, dimana kehilangan bit rate foto tidak berpengaruh pada citra.
Teknik Kompresi Citra (2)
Beberapa teknik lossy
Color reduction : untuk warna-warna tertentu yang mayoritas dimana informasi warna disimpan dalam color palette.
Chroma subsampling : teknik yang memanfaatkan fakta bahwa mata manusia merasa brightness (luminance) lebih berpengaruh daripada warna (chrominance) itu sendiri, maka dilakukan pengurangan resolusi warna dengan disampling ulang. Biasanya digunakan pada sinyal YUV.
Chorma Subsampling terdiri dari 3 komponen :
Y (luminance) : U (CBlue) : V (CRed)
11
Downsampling
The human eye can see more detail in the Y component (brightness) than in Cb (blue) and Cr (red). Using this knowledge, encoders can be designed to compress images more efficiently. (http://en.wikipedia.org)
Transformasi warna dari RGB ke ruang warna (color space) dinamakan YCbCr.
Pengurangan komponen Cb dan Cr dinamakan "downsampling" atau "chroma subsampling
Downsampling the chroma components menghemat 33% atau 50% space yang digunakan image.
Contoh Downsampling
Rasio downsampling pada JPEG adalah 4:4:4 (no downsampling), 4:2:2 (reduce by factor of 2 in horizontal direction), dan 4:2:0 (reduce by factor of 2 in horizontal and vertical directions).
Teknik Kompresi Citra (3)
Transform coding : menggunakan Fourier Transform seperti DCT (Discrete Cosine Transform).
Fractal Compression : adalah suatu metode lossy untuk mengkompresi citra dengan menggunakan kurva fractal. Sangat cocok untuk citra natural seperti pepohonan, pakis, pegunungan, dan awan.
Fractal Compression bersandar pada fakta bahwa dalam sebuah image, terdapat bagian-bagian image yang menyerupai bagian image yang lain.
Proses kompresi Fractal lebih lambat daripada JPEG sedangkan proses dekompresinya sama.
Hal-Hal Penting Dalam Kompresi Citra
Scalability/Progressive Coding/Embedded Bitstream
Adalah kualitas dari hasil proses pengkompresian citra karena manipulasi bitstream tanpa adanya dekompresi atau rekompresi.
Biasanya dikenal pada loseless codec.
Contohnya pada saat preview image sementara image tersebut didownload. Semakin baik scalability, makin bagus preview image.
Hal-Hal Penting Dalam Kompresi Citra
Tipe scalability :
Quality progressive : dimana image dikompres secara perlahan-lahan dengan penurunan kualitasnya.
Resolution progressive : dimana image dikompresi dengan mengenkode resolusi image yang lebih rendah terlebih dahulu baru kemudian ke resolusi yang lebih tinggi.
Component progressive : dimana image dikompresi berdasarkan komponennya, pertama mengenkode komponen grey baru kemudian komponen warnanya.
Hal-Hal Penting Dalam Kompresi Citra
Region of Interest Coding : daerah-daerah tertentu dienkode dengan kualitas yang lebih tinggi daripada yang lain.
Meta Information : image yang dikompres juga dapat memiliki meta information seperti statistik warna, tekstur, small preview image, dan author atau copyright information
Algoritma Kompresi/Dekompresi Citra (1)
Algoritma umum untuk kompresi image adalah :
1. Menentukan bitrate dan toleransi distorsi image dari inputan user.
2. Pembagian data image ke dalam bagian-bagian tertentu sesuai dengan tingkat kepentingan yang ada (classifying).
Menggunakan salah satu teknik : DWT (Discreate Wavelet Transform) : mencari frekuensi nilai pixel masing-masing, menggabungkannya menjadi satu dan mengelompokkannya sebagai berikut:
Algoritma Kompresi/Dekompresi Citra (2)
Dimana
LL : Low Low Frequency (most importance)
HL : High Low Frequency (lesser importance)
LH : Low High Frequency (more lesser importance)
HH : High High Frequency (most less importance)
Algoritma Kompresi/Dekompresi Citra (3)
Hasil dekomposisi 3 level decomposition
Algoritma Kompresi/Dekompresi Citra (4)
3. Pembagian bit-bit di dalam masing-masing bagian yang ada (bit allocation).
4. Lakukan kuantisasi (quantization).
Kuantisasi Scalar : data-data dikuantisasi sendiri-sendiri
Kuantisasi Vector : data-data dikuantisasi sebagai suatu himpunan nilai-nilai vektor yang diperlakukan sebagai suatu kesatuan.
5. Lakukan pengenkodingan untuk masing-masing bagian yang sudah dikuantisasi tadi dengan menggunakan teknik entropy coding (huffman dan aritmatik) dan menuliskannya ke dalam file hasil.
Algoritma Kompresi/Dekompresi Citra
Sedangkan algoritma umum dekompresi image adalah :
1. Baca data hasil kompresi menggunakan entropy dekoder.
2. Dekuantisasi data.
3. Rebuild image.
Beberapa Metode Kompresi Citra
Teknik Kompresi GIF
GIF (Graphic Interchange Format) dibuat oleh Compuserve pada tahun 1987 untuk menyimpan berbagai file bitmap menjadi file lain yang mudah diubah dan ditransmisikan pada jaringan komputer.
GIF merupakan format citra web yang tertua yang mendukung kedalaman warna sampai 8 bit (256 warna), menggunakan 4 langkah interlacing, mendukung transparency, dan mampu menyimpan banyak image dalam 1 file.
Byte ordering : LSB MSB
Interlacing
Interlacing separates the odd and even lines and transmits them separately. It allows the overall frame rate to be half what it would need to be if the whole display were delivered progressively. Thus, it reduces the bandwidth required to 50% and is therefore a form of compression.
Struktur file GIF (1)
Header : menyimpan informasi identitas file GIF (3 bytes, harus string GIF) dan versinya (3 bytes, harus string 87a or 89b)
Global Screen Descriptor (GSD) : mendefinisikan logical screen area dimana masing-masing file GIF ditampilkan.
Struktur file GIF (3)
Global Color Table : masing-masing image dalam GIF dapat menggunakan global color table atau tabel warnanya sendiri-sendiri. Penggunaan GCT akan memperkecil ukuran file GIF.
Image1, Image2, Image3, ... Image-n : dimana masing-masing image memiliki struktur blok sendiri-sendiri dan terminator antar file.
Trailer : Akhir dari sebuah file GIF
Struktur file GIF (2)
Struktur file GIF (4)
Kompresi GIF menggunakan teknik LZW : gambar GIF yang berpola horizontal dan memiliki perubahan warna yang sedikit, serta tidak bernoise akan menghasilkan hasil kompresan yang baik.
Kompresi LZW (Lempel, Ziv dan Welch) pada GIF
Proses encoding yang mencari rangkaian pixel yang sama pada gambar. Pola yang lebih sering muncul mendapatkan sebuah kode yang mewakili rangkaian tersebut dalam file terkompresi.
Format file GIF
GIF87a : mendukung interlacing dan mampu manyimpan beberapa image dalam 1 file, ditemukan tahun 1987 dan menjadi standar.
GIF89a : kelanjutan dari 87a dan ditambahkan dengan dukungan transparency, mendukung text, dan animasi.
Animated GIF
Animated GIF : tidak ada standar bagaimana harus ditampilkan sehingga umumnya image viewer hanya akan menampilkan image pertama dari file GIF. Animated GIF memiliki informasi berapa kali harus diloop.
Tidak semua bagian dalam animated GIF ditampilkan kembali, hanya bagian yang berubah saja yang ditampilkan kembali.
JPEG
JPEG (Joint Photograpic Experts Group) menggunakan teknik kompresi lossy sehingga sulit untuk proses pengeditan.
JPEG cocok untuk citra pemandangan (natural generated image), tidak cocok untuk citra yang mengandung banyak garis, ketajaman warna, dan computer generated image
JPEG Compression Models (1)
Sequential : kompresi dilakukan secara top-down, left-right menggunakan proses single-scan dan algoritma Huffman Encoding 8 bit secara sekuensial.
JPEG Compression Models (2)
Progressive : kompresi dilakukan dengan multiple-scan secara progresif, sehingga kita dapat mengira-ngira gambar yang akan kita download.
JPEG Compression Models (3)
Hierarchical : super-progressive mode, dimana image akan dipecah-pecah menjadi sub image yang disebut frame. Frame pertama akan membentuk image dalam resolusi rendah hingga berangsur-angsur ke resolusi tinggi.
Loseless (JPEG-LS) : exact image
Teknik Kompresi JPEG
JPEG merupakan nama teknik kompresi, sedangkan nama format filenya adalah JFIF (JPEG File Interchange Format)
Tingkat kompresi yang baik untuk JPEG adalah 10:1-20:1 untuk citra foto, 30:1-50:1 untuk citra web, dan 60:1-100:1 untuk kualitas rendah seperti citra untuk ponsel.
Byte order : MSB-LSB
JPEG
Tahapan Kompresi JPEG (1)
Sampling : adalah proses pengkonversian data pixel dari RGB ke YUV/YIQ dan dilakukan down sampling. Biasanya sampling dilakukan per 8x8 blok, semakin banyak blok yang dipakai makin bagus kualitas sampling yang dihasilkan.
DCT (Discreate Cosine Transform) : hasil dari proses sampling akan digunakan sebagai inputan proses DCT, dimana blok 8x8 pixels akan diubah menjadi fungsi matriks cosinus
Tahapan Kompresi JPEG (2)
Quantization : proses membersihkan koefisien DCT yang tidak penting untuk pembentukan image baru. Hal ini yang menyebabkan JPEG bersifat lossy.
Entropy Coding : proses penggunaan algoritma entropy, misalnya Huffman atau Aritmatik untuk mengenkodekan koefisien hasil proses DCT yang akan mengeliminasi nilai-nilai matriks yang bernilai nol secara zig-zag order.
Tahapan Kompresi JPEG (3)
Baseline sequential JPEG encoding and decoding processes
Step 1: Picture Preparation (a)
Color space transformation
First, the image is converted from RGB into a different color space called YCbCr. This is the same as the color space used by PAL, MAC and Digital color television transmission.
The Y component represents the brightness of a pixel
The Cb and Cr components together represent the chrominance
475 x 330 x 3 = 157 KB
luminance
RGB Components
Y U V (Y Cb Cr) Components
Assign more bits to Y, less bits to Cb and Cr
Y U V (Y Cb Cr) Components
Assign more bits to Y, less bits to Cb and Cr
Step 1: Picture Preparation (b)
Downsampling
The human eye can see more detail in the Y component than in Cb and Cr. Using this knowledge, encoders can be designed to compress images more efficiently.
The above transformation enables the next step, which is to reduce the Cb and Cr components (called "downsampling" or "chroma subsampling").
Typically each group of 4 pixels would be sampled with 4 values for Y and only 1 each for U & V (sampling ratio of 4:1:1).
For the rest of the compression process, Y, Cb and Cr are processed separately and in a very similar manner.
Step 1: Picture Preparation (b)
Downsampling
Original: 12 blocks.
Sampled: 4 + 1 + 1 = 6 blocks.
Compression ratio = 50%.
There is 75% lost in chrominance components
For the rest of the compression process, Y, Cb and Cr are processed separately and in a very similar manner.
Step 2: Picture Processing
Discrete Cosine Transform
Next, each component (Y, Cb, Cr) of the image is "tiled" into sections of eight by eight pixels each, then each tile is converted to frequency space using a two-dimensional forward discrete cosine transform.
Within the MCU, each component is processed separately one 8x8 block at a time.
The luminance block is shifted from numbers 0..255 to numbers 128..127 by subtracting 128.
Chrominance values are already in the range 128..127.
The 64 (8 X 8) DCT Basis Functions
Each 8x8 block can be looked at as a weighted sum of these basis functions.
The process of 2D DCT is also the process of finding those weights.
50
This is another explanation of 2D DCT.
Step 2: Picture Processing
Each block is transformed by the forward DCT into low- and high-frequency information.
This step is lossless, except that there may be little lost due to rounding of DCT coefficients
If one such 88 8-bit subimage is:
JPEG Image Compression II
DCT: similar to FT; only real (cosine) part is kept.
Identifies average value (dc coefficient) and remaining components (ac coefficients).
Step 2: Picture Processing
which, if we now subtract 128 from each element, results in
and then taking the DCT and rounding to the nearest integer results in
Note the rather large value of the top-left corner. This is the DC coefficient. The remaining 63 coefficients are called the AC coefficients.
Step 3: Quantization
The human eye is good at seeing small differences in brightness over a relatively large area, but not so good at distinguishing the exact strength of a high frequency brightness variation.
This fact allows one to get away with greatly reducing the amount of information in the high frequency components.
This is done by simply dividing each component in the frequency domain by a constant for that component, and then rounding to the nearest integer.
This is the main lossy operation in the whole process.
Step 3: Quantization
As a result of this, it is typically the case that many of the higher frequency components are rounded to zero, and many of the rest become small positive or negative numbers.
A common quantization matrix is:
Step 3: Quantization
Using this quantization matrix with the DCT coefficient matrix from above results in:
For example, using 415 (the DC coefficient) and rounding to the nearest integer
The quantization matrix may be scaled by a quality factor
Step 4: Entropy Encoding
Entropy coding is a special form of lossless data compression.
DC Coefficient Coding the difference between the quantized DC coefficient of the current block and that of the previous block of the same component is taken.
Step 4: Entropy Encoding
AC Coefficient Coding
the 63 quantized coefficients are converted into a one-dimensional zig-zag sequence to increase the run length of zeros.
- zero run-length encoding is then applied.
- Huffman coding or arithmetic encoding is then further applied.
Zig-zag Scan DCT Blocks
Why? -- To group low frequency coefficients in top of vector.
Maps 8 x 8 to a 1 x 64 vector.
Horizontal frequency
Vertical frequency
59
The zig-zag sequence for the above quantized coefficients would be:
26,
3, 0,
3, 2, 6,
2, 4, 1, 4,
1, 1, 5, 1, 2,
1, 1, 1, 2, 0, 0,
0, 0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
0, 0,
0
DC coefficient is -26
Zero run-length encoding is
(0, -3),
(1, -3), (0, -2), (0, -6), (0, 2), (0, -4),
(0, 1), (0, -4), (0, 1), (0, 1), (0, 5), (0, 1),
(0, 2), (0, -1), (0, 1), (0, -1), (0, 2),
(5, -1), (0, -1),
(0, 0)
Decoding
Decoding to display the image consists of doing all the above in reverse.
Taking the DCT coefficient matrix (after adding the difference of the DC coefficient back in)
Decoding
and multiplying it by the quantization matrix from above results in
which closely resembles the original DCT coefficient matrix for the top-left portion.
Original
63
Decoding
Taking the inverse DCT (type-III DCT) results in an image with values (still shifted down by 128)
and adding 128 to each entry
Original
64
Latihan
Given the following matrices
Matrix A : 8 x 8 luminance block.
Matrix B : 8 x 8 Quantization matrix (luminance)
For this luminance block, obtain a Matrix C by subtracting each entry from 128.
Obtained the DCT coefficient matrix as a result of apply DCT to Matrix C.
Compute the quantized coefficients using truncation to the nearest integers and then write them out in a zig-zag order.
Compute the quantized coefficients by rounding to the nearest integers and then write them out in a zig-zag order.
Compare the merits of using each of the techniques in parts (d) and (e) above.
JPEG 2000
JPEG 2000 merupakan pengembangan kompresi JPEG.
Didesain untuk internet, scanning, foto digital, remote sensing, medical imegrey, perpustakaan digital dan e-commerce
Kelebihan :
Dapat digunakan pada bit-rate rendah sehingga dapat digunakan untuk network image dan remote sensing
Menggunakan Lossy dan loseless tergantung kebutuhan bandwidth. Loseless digunakan untuk medical image
Transmisi progresif dan akurasi & resolusi pixel tinggi
Menggunakan Region of Interest (ROI)
JPEG 2000
Kelebihan (lanjutan) :
Robustness to bit error yang digunakan untuk komunikasi jaringan dan wireless
Open architecture : single compression/decompression
Mendukung protective image security : watermarking, labeling, stamping, dan encryption
Mendukung image ukuran besar 64k x 64k, size up to 232 - 1
Mendukung meta data dan baik untuk computer-generated imagenary. Dulu JPEG standar baik untuk natural imagenary.
2-D Wavelet Transform via Separable Filters
From Matlab Wavelet Toolbox Documentation
1/18/2010
69
2-D Example
From Usevitch (IEEE Sig.Proc. Mag. 9/01)
015614152728
2471316262942
38121725304143
911182431404453
1019233239455254
2022333846515560
2134374750565961
3536494857586263
Sheet1
0.2
-0.6
0.8
-1
1
-0.8
0.6
-0.2
1
Sheet1
U=7
Amplitude
Sheet2
015614152728
2471316262942
38121725304143
911182431404453
1019233239455254
2022333846515560
2134374750565961
3536494857586263
-10-10-101010-10-10-10
-10101010101010-10
1010101010101010
1010101010101010
1010101010101010
1010101010101010
-10101010101010-10
-10-10-101010-10-10-10
400-26000-110
00000000
-450-24080-100
00000000
-2000020000
00000000
-3010018040
00000000
Sheet3
Kuliah09-Deteksi%20Tepi%20(Edge%20Detection)_01_print_version.pdf
11/22/2009
1
Deteksi Tepi (Edge Detection)Yeni Herdiyeni
Departemen Ilmu Komputer FMIPA IPB
www.ilkom.fmipa.ipb.ac.id/yeni
Deteksi Tepi
Deteksi tepi (Edge detection) adalah operasi yang dijalankan untuk mendeteksi garis tepi (edges) yang membatasi dua wilayah citra homogen yang memiliki tingkat kecerahan yang berbeda (Pitas 1993).
Tujuannya adalah untuk mengubah citra 2D menjadi bentuk kurva.
Edge adalah beberapa bagian dari citra di mana intensitas kecerahan berubah secara drastis.
http://www.ilkom.fmipa.ipb.ac.id/yeni
11/22/2009
2
Edge
Deteksi Edge
Edge adalah beberapa bagian dari citra di mana intensitas kecerahan berubah secara drastis.
Dalam objek berdimensi 1, perubahan dapatdiukur dengan menggunakan fungsi turunan(derivative function).
Perubahan mencapai maksimum pada saat nilaiturunannya pertamanya mencapai nilaimaksimum atau nilai turunan kedua (2nd
derivative) bernilai 0.
11/22/2009
3
Edge Detection Using the Gradient
Properties of the gradient:
The magnitude of gradient
provides information about
the strength of the edge
The direction of gradient is
always perpendicular to the
direction of the edge
Main idea:
Compute derivatives in x and y directions
Find gradient magnitude
Threshold gradient magnitude
Edge Detection Using the Gradient
Estimating the gradient with finite differences
Approximation by finite differences:
11/22/2009
4
Edge Detection Using the Gradient
Using pixel-coordinate notation (remember: j corresponds
to the x direction and i to the negative y direction):
Edge Detection Using the Gradient
Example:
Suppose we want to
approximate the gradient
magnitude at z5
We can implement I/ x and I/ y using the following masks:
Note: Mx is the approximation at (i, j + 1/2)
and My is the approximation at (i + 1/2, j)
11/22/2009
5
Edge Detection Using the Gradient
The Roberts edge detector
This approximation can be implemented by the following masks:
Note: Mx and My are approximations at (i + 1/2, j + 1/2)
Edge Detection Using the Gradient
The Prewitt edge detector
The partial derivatives can be computed by:
Note: Mx and My are approximations at (i, j))
Consider the arrangement of
pixels about the pixel (i, j):
The constant c implies the emphasis given to pixels closer to the
center of the mask.
Setting c = 1, we get the Prewitt operator:
11/22/2009
6
Algoritme Deteksi Tepi
Robert Operator
Sobel Operator
Prewitt Operator
Canny Operator
Laplacian operator
dan lain-lain.
Edge Detection Using the Gradient
The Sobel edge detector
Note: Mx and My are approximations at (i, j))
Setting c = 2, we get the Sobel operator:
11/22/2009
7
Edge Detection Using the Gradient
(an example using the Prewitt edge detector - dont divide by 2)
Operator Robert
Robert Operator menggunakan operator gradient berukuran 2 x 2 :
Gradient magnitude
Karena operator Robert hanya menggunakanconvolution mask berukuran 2 x 2, maka operator Robert sangat sensitive terhadap noise.
11/22/2009
8
Operator Sobel #1
Operator Gradient 3 x 3
Operator Sobel melakukan deteksi tepidengan memperhatikan tepi vertical danhorizontal.
Operator Sobel #2
Gradient Magnitude
11/22/2009
9
Operator Prewitt
Operator Prewitt menggunakan 8 (delapan) buah kernel operator gradient
Implementasi Matlab Deteksi tepi dengan operator Prewitt
citra=imread('cameraman.tif');ic = citra (:,:,1);
px=[-1 0 1;-1 0 1;-1 0 1]; %% Deteksi Vertikalicx=filter2(px,ic); % convolutionfigure,imshow(icx/255);
py=px'; %% Deteksi Horizontalicy=filter2(py,ic);figure,imshow(icy/255);
edge_p=sqrt(icx.^2+icy.^2);figure,imshow(edge_p/255);
edge_t=im2bw(edge_p/255,0.3);figure, imshow(edge_t);
11/22/2009
10
Edge Detection Using the Gradient
Example:
Idx
d
Idy
d
Edge Detection Using the Gradient
Example cont.:
22
Idy
dI
dx
d
11/22/2009
11
Edge Detection Using the Gradient
Example cont.:
100Threshold
Edge Detection Using the Gradient
11/22/2009
12
Edge Detection Using the Gradient
Image Gradient
Perubahan intensitas kecerahan dapatdihitung dengan menggunakan gradient citra(image gradient).
11/22/2009
13
Edge Detection Using the Gradient
Definition of the gradient:
To save computations, the magnitude of gradient is usually
approximated by:
Gradient Magnitude
gradient magnitude. Gradient Magnitude dapat dihitung dengan cara:
11/22/2009
14
Effects of noise Consider a single row or column of the image
Plotting intensity as a function of position gives a signal
Where is the edge?
Where is the edge?
Solution: smooth first
Look for peaks in
11/22/2009
15
Derivative theorem of convolution
This saves us one operation:
Tugas #3
Buat program deteksi Tepi dengan menggunakan operator
Robert
Prewitt
Sobel
Program tidak boleh menggunakan fungsi MATLAB
Kuliah10 Hough Transform.pdf
12/11/2008
1
Hough Transform
Yeni Herdiyeni
Departemen Ilmu Komputer IPB
http:www.ilkom.fmipa.ipb.ac.id/yeni
2
Feature extraction
Citra dijital
Ekstraksi ciri : bentuk
1. Segmentasi
2. Ekstraksi Bentuk
- Edge detection
- Hough transform
Ciri bentuk untuk
pengindeksan
12/11/2008
2
3
Intensitas gradien
yang berbeda (Pitas 1993)
Edge Detection
Good Detection
Good Localization
Clear Response
Canny Edge Detector:
Dikembangkan oleh
John F. Canny in
1986.
Citra dijital
4
12/11/2008
3
Hough Transform
5
Hough Transform
6
12/11/2008
4
Hough Transform
7
8
Diperkenalkan oleh Paul Hough, 1962
The Hough Transform (HT) is a technique that locates shapes in images.
.there are an infinite number of potential lines that pass
through any point, each at a different orientation.
y = mx + c
Hough Transform
c = (-x)m + y
12/11/2008
5
Hough Transform
sebuah titik (xi,yi) dalam ruang koordiant-xy dapat
ditransformasi menjadi sebuah persamaan garis pada
ruang koordinat-mc.
9
10
Titik perpotongantiga garis (-1,4)
A
12/11/2008
6
Hough Transform
11
12
Hough Transform Line (r, ):
Local maxima
Parameter space (r, )
r
x
y
Dikembangkan oleh Richard Duda dan
Peter Hart, 1972
Standard Hough Transform (SHT)
r = xi cos + yi sin
Hough Transform
xi
yi
r
12/11/2008
7
Hough Transform
13
Hough Transform
14
12/11/2008
8
Hough Transform
15
Algoritme
1. Tentukan nilai
2. Untuk setiap piksel (x,y) hitung nilai r = x
cos + y sin untuk semua nilai
3. Buat array nilai dan r
16
12/11/2008
9
17
Hough Transform Circle (x0, y0, r):
Local maxima
x = x0 + r cos
y = y0 + r sin
x0
y0
x0
y0
Hough Transform
r (x, y)
x0
y0
18
Hough Transform
Hough transform circle
12/11/2008
10
19
Hough Transform Ellipse (x0, y0, rx, ry):
rx
ry
y0
x0
(x, y)x = x0 + rx cos
y = y0 + ry sin
x0
y0
x0
y0
Local maxima
Hough Transform
20
Hough Transform
Hough transform ellipse
12/11/2008
11
21
1. DaffodilCitra asli Citra biner Hasil Hough Transform
(a) Circle
(b) Ellipse
22
2. LilyCitra asli Citra biner Hasil Hough Transform
(a) Circle
(b) Ellipse
12/11/2008
12
23
3. Morning GloryCitra asli Citra biner Hasil Hough Transform
(a) Circle
(b) Ellipse
24
Citra asli Citra biner Hasil Hough Transform
(a) Circle
(b) Ellipse
4. Rose
12/11/2008
13
25
Shape Indexing
nnnn
n
n
ppp
ppp
ppp
P
21
22221
11211
1
nn
nn
nn
p
p
p
p
p
P
1
2
12
11
1
nn
nn
nn
p
p
p
p
p
Pm
1
2
12
11
HT Matrik 50x50 Matrik 2500x1
nn
nn
nn
p
p
p
p
p
P
1
2
12
11
1
nn
nn
nn
p
p
p
p
p
P
1
2
12
11
2
P = [ P1 P2 Pm ]
nn
nn
nn
nn
nn
nn
nn
nn
nn
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
P
1
2
12
11
1
2
12
11
1
2
12
11
26
Similarty Measure
n
n
n
q
q
q
q
q
Q
1
2
2
1
Kueri
n
n
n
n
n
n
n
n
n
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
P
1
2
2
1
1
2
2
1
1
2
2
1
Euclidean distance (P, Q):
n
i
ii
nn
)q(pd
)q(p...)q(p)q(pd
1
2
22
22
2
11
(Gonzalez 2004)
12/11/2008
14
27
Terima kasih.
Transformasi fourier 1 dimensi.ppt
Transformasi fourier
1 dimensi
Kuliah PPCD
aziz kustiyo
departemen ilmu komputer fmipa ipb
Transformasi Fourier
Mengapa perlu transformasi ?
Setiap orang pada suatu saat pernah menggunakan suatu teknik analisis dengan transformasi untuk menyederhanakan penyelesaian suatu masalah [Brigham,1974]
Contoh: penyelesaian fungsi y = x/z
Analisa konvensional : pembagian secara manual
Analisa transformasi : melakukan transformasi
log(y) = log(x) log(z)
look-up table pengurangan look-up table
Transformasi juga diperlukan bila kita ingin mengetahui suatu informasi tertentu yang tidak tersedia sebelumnya
Contoh :
jika ingin mengetahui informasi frekuensi kita memerlukan transformasi Fourier
Jika ingin mengetahui informasi tentang kombinasi skala dan frekuensi kita memerlukan transformasi wavelet
Transformasi citra, sesuai namanya, merupakan proses perubahan bentuk citra untuk mendapatkan suatu informasi tertentu
Transformasi bisa dibagi menjadi 2 :
Transformasi piksel/transformasi geometris:
Transformasi ruang/domain/space
Transformasi Citra
Transformasi Pixel
Transformasi piksel masih bermain di ruang/domain yang sama (domain spasial), hanya posisi piksel yang kadang diubah
Contoh: rotasi, translasi, scaling, invers, shear, dll.
Transformasi jenis ini relatif mudah diimplementasikan dan banyak aplikasi yang dapat melakukannya (Paint, ACDSee, dll)
Transformasi Ruang
Transformasi ruang merupakan proses perubahan citra dari suatu ruang/domain ke ruang/domain lainnya, contoh: dari ruang spasial ke ruang frekuensi
Masih ingat istilah ruang ? Ingat-ingat kembali pelajaran Aljabar Linier tentang Basis dan Ruang
Contoh : Ruang vektor. Salah satu basis yang merentang ruang vektor 2 dimensi adalah [1 0] dan [0 1]. Artinya, semua vektor yang mungkin ada di ruang vektor 2 dimensi selalu dapat direpresentasikan sebagai kombinasi linier dari basis tersebut.
Ada beberapa transformasi ruang yang akan kita pelajari, yaitu :
Transformasi Fourier (basis: cos-sin)
Transformasi Hadamard/Walsh (basis: kolom dan baris yang ortogonal)
Transformasi DCT (basis: cos)
Transformasi Wavelet (basis: scaling function dan mother wavelet)
Pada tahun 1822, Joseph Fourier, ahli matematika dari Prancis menemukan bahwa: setiap fungsi periodik (sinyal) dapat dibentuk dari penjumlahan gelombang-gelombang sinus/cosinus.
Contoh : Sinyal kotal merupakan penjumlahan dari fungsi-fungsi sinus berikut (lihat gambar pada halaman berikut)
Transformasi Fourier
f(x) = sin(x) + sin(3x)/3 + sin(5x)/5 +
sin(7x)/7 + sin(9x)/9
Hasil dalam transformasi fourier
Cobakan juga program matlab berikut untuk melihat sampai batas n berapa fungsi yang dihasilkan sudah berbentuk fungsi kotak.
function kotak(n)
t = 0:pi/200:8*pi;
kot = sin(t);
for i = 3 : 2: n
kot = kot + (sin(i*t))/i;
end
plot(kot)
Fungsi kotak sebagai penjumlahan fungsi-fungsi sinus
Gambar a) n = 1, b) n =3, c) n = 7, d) n = 99
(a)
(c)
(d)
(b)
Contoh lain
Contoh lain
Contoh lain
FT - Motivasi
Jika semua sinyal periodik dapat dinyatakan dalam penjumlahan fungsi-fungsi sinus-cosinus, pertanyaan berikutnya yang muncul adalah:
Jika saya memiliki sebuah sinyal sembarang, bagaimana saya tahu fungsi-fungsi cos sin apa yang membentuknya ?
Atau dengan kata lain
Berapakah frekuensi yang dominan di sinyal tersebut ?
Pertanyaan di atas dapat dijawab dengan menghitung nilai F(u) dari sinyal tersebut. Dari nilai F(u) kemudian dapat diperoleh kembali sinyal awal dengan menghitung f(x), menggunakan rumus:
Rumus FT 1 dimensi
Rumus FT kontinu 1 dimensi
Rumus FT diskret 1 dimensi
Contoh FT 1 dimensi
Contoh berikut diambil dari Polikar
(http://engineering.rowan.edu/~polikar/WAVELETS/WTtutorial.html)
Misalkan kita memiliki sinyal x(t) dengan rumus sbb:
x(t) = cos(2*pi*5*t) + cos(2*pi*10*t) +
cos(2*pi*20*t) + cos(2*pi*50*t)
Sinyal ini memiliki empat komponen frekuensi yaitu 5,10,20,50
Contoh sinyal 1 Dimensi x(t)
Gambar sinyal satu dimensi dengan rumus
x(t)= cos(2*pi*5*t) +
cos(2*pi*10*t) +
cos(2*pi*20*t) +
cos(2*pi*50*t)
(Sumber: Polikar)
FT dari sinyal tersebut
FT dari sinyal tersebut.
Terlihat bahwa FT dapat menangkap frekuensi-frekuensi yang dominan dalam sinyal tersebut, yaitu 5,10, 20, 50
(nilai maksimum F(u) berada pada angka 5,10, 20, 50)
Contoh Penghitungan FT 1 dimensi
Contoh Penghitungan FT 1 dimensi
Hasil penghitungan FT biasanya mengandung bilangan real dan imajiner
Fourier Spectrum didapatkan dari magnitude kedua bilangan tersebut shg|F(u)| = [R 2(u) + I 2(u)]1/2
Untuk contoh di halaman sebelumnya, Fourier Spectrumnya adalah sebagai berikut:
|F(0)| = 3.25|F(1)| = [(-0.5)2+(0.25)2]1/2 = 0.5590
|F(2)| = 0.25|F(3)| = [(0.5)2+(0.25)2]1/2 = 0.5590
ux
j
ux
ux
j
du
ux
j
u
F
x
f
dx
ux
j
x
f
u
F
p
p
p
p
p
2
sin
2
cos
]
2
exp[
:
formula
s
Euler'
]
2
exp[
)
(
)
(
]
2
exp[
)
(
)
(
-
=
-
=
-
=
-
-
-
=
-
=
=
-
=
1
0
1
0
]
/
2
exp[
)
(
1
)
(
]
/
2
exp[
)
(
1
)
(
N
x
N
x
N
ux
j
u
F
N
x
f
N
ux
j
x
f
N
u
F
p
p