format file bitmap
TRANSCRIPT
IF-UTAMA 4/4/2012
1
Format File Bitmap
Dosen Pembina :
Sriyani Violina, M.T.
Danang Junaedi
1
RASTER GRAPHICS
2
alfeacamia.cmswiki.wikispaces.net/file/view/2.01+Raster+Graphics.ppt
Raster Graphics
• Also called bitmap
graphics
• Consist of grids of tiny dots called pixels
• Have a fixed resolution and cannot
be resized without altering image quality
• Edited in paint
programs Bitmap enlargement
Notice the pixels
Image source: http://graphicssoft.about.com/od/aboutgraphics/a/bitmapvector.htm
3
Common Raster Formats
• GIF
• JPEG
• BMP
• PNG
• TIFF
4
IF-UTAMA 4/4/2012
2
GIF – Graphics Interchange Format
� Animation – Standard
format for animation on
the Internet.
� Transparency – yes
• Lossless compression
• Colors = 256 (8-bit)
• Most common format for:
– Text
– Clip art, animations, icons, logos
– Simple diagrams, line drawings
– Graphics with large blocks
of a single color
– Graphics with transparent
areas
– Images displayed on computer screens and on
websites.Animated Gif
5
JPEG – Joint Photographic Experts Group
X Animation – No
X Transparency – No
• Lossy compression
• Colors – 16.7 M (24-bit)
• High quality but larger file
size than a GIF
• Commonly Used For:
– Desktop publishing photographs
– Photographs and natural
artwork
– Scanned photographs
– Emailing photographs
– Digital camera photographs
6
BMP - Bitmap
X Animation – No
X Transparency – No
• Uncompressed
• 256 colors
• Large file size - not well suited for transfer
across the Internet or for print publications
• Commonly Used For:
– Editing raster graphics
– Creating icons and
wallpaper
– On-screen display
Icons 7
PNG – Portable Network Graphics
X Animation – no
� Transparency – yes
• Lossless compression
• 256 colors
– Not suited for
photographs
• Commonly Used For:
– Replacing GIF and
TIFF images
– Online viewing of
images
• See examples at
http://graphicssoft.about.com/od/freedownlo
ads/l/blfreepng07.htm
8
IF-UTAMA 4/4/2012
3
TIFF – Tagged Image File Format
X Animation – No
X Transparency – No
• Available in compressed
and un-compressed
formats
• Compressed is advised
• Colors – 16 M (24-bit)
• Commonly Used For:
– Storage container for faxes and other digital images
– To store raw bitmap data
by some programs and devices such as scanners
– High resolution printing
– Desktop Publishing images
9
Demonstration of File Sizes
10samsclass.info/131/pptF05/ch09.ppt
BITMAP
11
1. pages.towson.edu/hilberg/COSC109/Ch06.ppt
2. Referensi lain yang terkait
BMP File Bitmap
• The BMP file format, sometimes called bitmap or DIB file format (for
device-independent bitmap), is an image file format used to store bitmap
digital images, especially on Microsoft Windows and OS/2 operating
systems.
• Bitmap is derived from the words ‘bit’, which means the simplest element in
which only two digits are used, and ‘map’, which is a two-dimensional matrix
of these bits. A bitmap is a data matrix describing the individual dots or
pixels (picture elements) of an image.
• Bitmapped images are known as paint graphics.
• Bitmapped images can have varying bit and color depths.
• Bitmaps are an image format suited for creation of:
– Photo-realistic images.
– Complex drawings.
– Images that require fine detail.
• Many graphical user interfaces use bitmaps in their built-in graphics subsystems;[1] for example, the Microsoft Windows and OS/2 platforms' GDI subsystem, where the specific format used is the Windows and OS/2 bitmap file format, usually named with the file extension of .BMP or .DIB.
12
IF-UTAMA 4/4/2012
4
Bitmaps
13
Available binary Combinations for Describing a
Color
Bitmaps
1. 24 bit color (millions of colors)
2. 8 bit color (256 colors)
3. 8 bit color (Mac optimized palette)
4. 4 bits color (16 colors)
5. 8 bit gray scale (256 shades)
6. 4 bit gray scale (16 shades)
7. 1 bit gray scale (2 shades)
14
Bitmaps
Bitmaps can be inserted by:
– Using clip art galleries - an assortment of graphics, photographs, sound, and video. A popular alternative for users who do not want to create their own images.
– Using bitmap software such as Adobe's Photoshop and Illustrator, Macromedia's Fireworks, Corel's Painter, CorelDraw, Quark Express.
– Capturing and editing images.
• Capturing and storing images directly from the screen is another
way to assemble images for multimedia.
• Image editing enables one to enhance and make composite images,
alter and distort images and add and delete elements.
– Scanning images from conventional sources and make necessary alterations and manipulations.
15
Device-independent bitmaps and BMP file
format
BMP File Header Stores general information about the BMP file.
Bitmap Information(DIB header)
Stores detailed information about the bitmap image.
Color PaletteStores the definition of the colors being used for indexed color bitmaps.
Bitmap Data Stores the actual image, pixel by pixel.
16
• Microsoft has defined a particular representation of color bitmaps of different color depths, as an aid to exchanging bitmaps between
devices and applications with a variety of internal representations. They called these device-independent bitmaps or DIBs, and the file format for them is called DIB file format or BMP file format.
• A typical BMP file usually contains the following blocks of data:
IF-UTAMA 4/4/2012
5
BMP file header• This block of bytes is at the start of the file and is used to identify the file.
• A typical application reads this block first to ensure that the file is actually a BMP file and that it is not damaged.
• Note that the first two bytes of the BMP file format (thus the BMP header) are stored in big-endian order.
• This is the magic number 'BM'. All of the other integer values are stored in little-endian format (i.e. least-significant byte first)
Offset# Size Purpose
0000h 2 bytes
the magic number used to identify the BMP file: 0x42 0x4D (Hex code points for B and M). The following entries are possible: •BM - Windows 3.1x, 95, NT, ... etc
•BA - OS/2 Bitmap Array •CI - OS/2 Color Icon •CP - OS/2 Color Pointer •IC - OS/2 Icon •PT - OS/2 Pointer
0002h 4 bytes the size of the BMP file in bytes
0006h 2 bytes reserved; actual value depends on the application that creates the image
0008h 2 bytes reserved; actual value depends on the application that creates the image
000Ah 4 bytesthe offset, i.e. starting address, of the byte where the bitmap data can be found.
17
Bitmap information (DIB header)
This block of bytes tells the application detailed information about the image, which will be used to display the image on the screen. The
block also matches the header used internally by Windows and OS/2 and has several different variants.
Size Header Identified by Supported by the GDI of
12 OS/2 V1BITMAPCOREH
EADER
OS/2 and also all Windows
versions since Windows 3.0
64 OS/2 V2BITMAPCOREH
EADER2
40 Windows V3BITMAPINFOHE
ADER
all Windows versions since
Windows 3.0
108 Windows V4BITMAPV4HEAD
ER
all Windows versions since
Windows 95/NT4
124 Windows V5BITMAPV5HEAD
ERWindows 98/2000 and newer
18
BITMAPFILEHEADER
Offset Size Name Description
0 2 bfType ASCII “BM”
2 4 bfSize Size of file (in bytes)
6 2 bfReserved1 Zero
8 2 bfReserved2 Zero
10 4 bfOffBits Byte offset in files where image begins
14 4 biSize Size of this header (40 bytes)
18 4 biWidth Image width in pixels
22 4 biHeight Image height in pixels
26 2 biPlanes Number of image planes, must
be 1
28 2 biBitCount Bits per pixel: 1,4,8, or 24
30 4 biCompression Compression type
19
BITMAPINFOHEADER (Windows 3) (cont’d)
Offset Size Name Description
34 4 biSizeImage Size of compressed image (in bytes),
zero if uncompressed
38 4 biXPelsPerMeter Horizontal resolution (pixels/meter)
42 4 biYPelsPerMeter Vertical resolution (pixels/meter)
46 4 biClrUsed Number of colors used
50 4 biClrImportant Number of ‘important’ color
54 4*N bmiColors Color map
20
IF-UTAMA 4/4/2012
6
Proses Pembacaan Citra 24 bit
21
Windows RGBQUAD
Offset Name Description
0 rgbBlue Blue value for color map entry
1 rgbGreen Green value
2 rgbRed Red value
3 rgbReserved Zero
22
Proses Penentuan Warna Ke Layar
• Untuk file 24 bit Informasi intensitas RGB sudah dapat langsung diketahui dari bitmap data, sedangkan untuk file 1,4,8 bit informasi
RGB diperoleh dari Color Map
23
Proses Penentuan Warna Ke Layar
• Pada umumnya setiap bahasa pemrograman telah
menyediakan fungsi untuk menghasilkan warna apabila
kita telah mengetahui intensitas RGB:
– Contoh dalam delphi:
• Image1.canvas.pixel(1,1)=RGB(10,8,2);
– Contoh dalam Visual Basic:
• PicBaru.PSet (SbX, SbY), RGB(10, 8, 2)
24
IF-UTAMA 4/4/2012
7
A
B
• Perlu diperhatikan bahwa dalam file data disimpan dari
belakang ke depan secara sequential. Berarti bitmap
data pertama adalah pixel pada posisi A dan bitmap data
terakhir adalah pixel pada posisi B
Penentuan Posisi Pixel
25
Color map
• Citra 1, 4, dan 8 bit per pixel butuh color map
• Entri dalam color map (palette) biasanya 2, 16, atau 256
– Bisa lebih sedikit jika citra tidak membutuhkan semua warna yang tersedia
– Jumlah warna yang digunakan = biClrUsed
– biClrUsed = 0 � color map memuat semua warna
– 4 byte per entri
• Entri awal color map = warna penting
– Jumlah warna penting = biClrImportant � jumlah warna yang diperlukan untuk mendapat tampilan citra yang cukup bagus
26
Proses Pembacaan Citra 8 bit
• Citra dengan kedalaman 8 bit berarti 1 pixel diwakili oleh 1 byte dan memiliki kemungkinan warna sebanyak 8 bit
• Prosesnya sama dengan pembacaan citra 24 bit dimana kita membaca :
• FileHeader sebesar 14 byte
• InfoHeader 40 byte
• ColorMap
• Bitmap Data
27
Proses Pembacaan Citra 8 bit
Dengan mengetahui informasi
mengenai OffBits maka kita bisa
menghitung posisi offset dari
ColorMap yaitu dimulai dari offset
54 sampai dengan nilai yang
tersimpan didalam offbits(X)
28
IF-UTAMA 4/4/2012
8
Proses Pembacaan Citra 8 bit
• Analogi Color Map adalah mengindex warna yang ada
ke dalam tabel sehingga bitmap data tidak lagi berisi
data intensitas RGB namun mengandung index warna
• Untuk mengetahui warna pixel(x) maka kita mengakses
color map dengan index sesuai dengan nilai yang
tersimpan pada bitmap data
29
Proses Pengambilan Warna dari Color Map
Berarti untuk pixel 1 intensitas
RGB : 56 5 9
Berarti untuk pixel 2 intensitas
RGB : 5 34 67
Berarti untuk pixel 3 intensitas
RGB : 5 34 67
COLORMAP
B 0RG B 0RG
BGR
0 9556
1 67345
15 67345
30
Menentukan Ukuran File dari Bitmap
• Yang membedakan antara citra 1,4,8,24 bit adalah ukuran storage yang digunakan untuk menyimpan warna dari 1 buah pixel
• Misalkan: citra A :200 x 200 pixel
– Hitung berapa minimum byte dari file bitmap yang dihasilkan bila:
a. citra A disimpan dalam 8 bit
b. citra A disimpan dalam 24 bit
– Solusi
a. 200 x 200 x 1 + 54 + 256 * 3 = 40822 byte
b. 200 x 200 x 3 + 54 = 120054 byte
31
EQUALISASI HISTOGRAM
SPESIFIKASI HISTOGRAM
32
IF-UTAMA 4/4/2012
9
Dua Pendekatan Image Enhancement
• Metode-metode berbasis domain frekwensi
– Manipulasi terhadap representasi frekwensi dari citra
– Contoh: operasi berbasis transformasi Fourier terhadap citra
• Metode-metode berbasis domain spasial
– Manipulasi langsung terhadap pixel-pixel pada citra
– Contoh: operasi histogram
33
Histogram citra
• Berlaku untuk nilai gray level; RGB � per plane warna
• Plotting dari persamaan:
– L: jumlah level
– pr(rk): probabilitas kemunculan level ke-k
– nk: jumlah kemunculan level k pada citra
– n: total jumlah pixel dalam citra
1,...,1,0;10;)( −=≤≤= Lkrn
nrp k
kkr
34
Contoh histogram
35
Equalisasi histogram
• Tujuan: melakukan transformasi terhadap histogram citra
asli sedemikian sehingga didapat histogram citra hasil
dengan distribusi lebih seragam (uniform) ≈ linearisasi
• Dasar konsep: transformasi probability density function
menjadi uniform density � bentuk kontinyu
• Agar dapat dimanfaatkan dalam pengolahan citra digital,
diubah ke bentuk diskrit
36
IF-UTAMA 4/4/2012
10
Equalisasi pada domain kontinyu
[ ] 1011)(
1)()(
:
10;)()(:
)()(:
)(
)(
0
)(
1
1
1
≤≤==
=
≤≤==
=
−
−
−
=
=
=
∫
srp
rpsp
Uniform
rdwwpsTssiTransforma
ds
drrpspHistogram
sTr
sTrr
rs
r
r
sTr
rs
37
Ilustrasi equalisasi pada domain kontinyu
38
Bentuk diskrit fungsi transformasi
10)(
1,...,1,0
10)()(
1
0 0
≤≤=
−=
≤≤===
−
= =
∑ ∑
kkk
kk
j
k
j
jr
j
kk
ssTr
Lk
rrp
n
nrTs
39
Operasi equalisasi histogram
1. Buat histogram dari citra asli
2. Transformasikan histogram citra asli menjadi
histogram dengan distribusi seragam
3. Ubah nilai tiap pixel sesuai dengan nilai hasil pemetaan (histogram asli � uniform histogram)
40
IF-UTAMA 4/4/2012
11
Pseudo Code : citra 512 x 512 pixel 256 graylevel
Var x,y,i,j : integer;
HistEq : array[0..255] of integer;
Hist : array[0..255] of real;Sum : real;
Begin
Histogram(image,Hist) {bentuk histogram dari citra asli}
for i:= ∅∅∅∅ to 255 do {transformasi ke uniform histogram}
sum := 0.0
for j:= ∅∅∅∅ to i dosum:= sum + hist[j]
endfor
histEq[i]:=round(255 * sum);
end;for y:=0 to 511 do {ubah nilai tiap pixel pada citra}
for x:=0 to 511 do
image[x,y]:= HistEq[Image[x,y]];end;
end;
end;
41
Contoh
Citra 64x64 pixel, 8 tingkat keabuan dgn distribusi:
rk nk pr(rk)=nk/n
r0=0 790 0,19
r1=1/7 1023 0,25
r2=2/7 850 0,21
r3=3/7 656 0,16
r4=4/7 329 0,08
r5=5/7 245 0,06
r6=6/7 122 0,03
r7=1 81 0,02
Histogram citra:
0
0,05
0,1
0,15
0,2
0,25
0,3
0 1/7 2/7 3/7 4/7 5/7 6/7 1
gray level (rk)
pro
ba
bil
ity (
pr(
r k))
42
Fungsi transformasi
00.1)()(
98.0)()(;95.0)()(
89.0)()(;81.0)()(
65.0)()()()()(
44.0)()()()(
19.0)()()(
7
0
77
6
0
66
5
0
55
4
0
44
3
0
33
210
2
0
22
10
1
0
11
0
0
0
00
===
======
======
=++===
=+===
====
∑
∑∑
∑∑
∑
∑
∑
=
==
==
=
=
=
j
jr
j
jr
j
jr
j
jr
j
jr
rrr
j
jr
rr
j
jr
r
j
jr
rprTs
rprTsrprTs
rprTsrprTs
rprprprprTs
rprprprTs
rprprTs
43
Fungsi transformasi: grafik
0
0,2
0,4
0,6
0,8
1
1,2
0 1/7 2/7 3/7 4/7 5/7 6/7 1
gray level (rk)
tran
sfo
rmed
valu
e (
sk)
44
IF-UTAMA 4/4/2012
12
Pembulatan
• 8 tingkat keabuan valid � nilai Sk dibulatkan ke nilai
valid terdekat [Normal (Sk x (tingkat kedalaman-1))]
� s0 = 0.19 ≅ 1/7
� s1 = 0.44 ≅ 3/7
� s2 = 0.65 ≅ 5/7
� s3 = 0.81 ≅ 6/7
� s4 = 0.89 ≅ 6/7
� s5 = 0.95 ≅ 1
� s6 = 0.98 ≅ 1
� s7 = 1.00 ≅ 1
45
Pemetaan
• Hanya ada 5 level keabuan pada uniform histogram
– r0 (790 pixel) � s0 = 1/7
– r1 (1023 pixel) � s1 = 3/7
– r2 (850 pixel) � s2 = 5/7
– r3 (656 pixel), r4 (329 pixel) � s3 = 6/7
– r5 (245 pixel),r6 (122 pixel),r7 (81 pixel) � s4 = 7/7
46
Histogram dengan distribusi seragam
0
0,05
0,1
0,15
0,2
0,25
0,3
0 1/7 2/7 3/7 4/7 5/7 6/7 1
gray leve l (sk)
pro
bab
ilit
y (
ps(s
k))
�Karena histogram merupakan aproksimasi terhadap
probability density function, sangat jarang didapat
histogram hasil yang betul-betul rata
47
Tabel Histogram secara Lengkap
rk nk pr(rk)=nk/n Sk Sk x 7 Normal(Sk)
r0=0 790 0,19 0,19 1,33 ≅≅≅≅ 1 s0=1/7
r1=1/7 1023 0,25 0,44 3,08 ≅≅≅≅ 3 s1=3/7
r2=2/7 850 0,21 0,65 4,55 ≅≅≅≅ 5 s2=5/7
r3=3/7 656 0,16 0,81 5,67 ≅≅≅≅ 6 s3=6/7
r4=4/7 329 0,08 0,89 6,23 ≅≅≅≅ 6 s4=6/7
r5=5/7 245 0,06 0,95 6,65 ≅≅≅≅ 7 s5=7/7
r6=6/7 122 0,03 0,98 6,86 ≅≅≅≅ 7 s6=7/7
r7=1 81 0,02 1,00 7 s7=1
48
Citra 64x64 pixel, 8 tingkat keabuan dgn distribusi:
IF-UTAMA 4/4/2012
13
Hasil Equalisasi
rj�sk nk ps(sk)
r0�s0=1/7 790 0,19
r1�s1=3/7 1023 0,25
r2�s2=5/7 850 0,21
r3,r4 �s3=6/7 985 0,24
r5,r6,r7 �s4=7/7 448 0,11
0
0,05
0 ,1
0 ,15
0 ,2
0 ,25
0 ,3
0 1/7 2 /7 3 /7 4 /7 5 /7 6 /7 1
g ra y le ve l (sk )
pro
bab
ilit
y (
ps(s
k))
49
Contoh1 equalisasi histogram
50
Contoh 2 equalisasi histogram
51
Spesifikasi histogram
• Kelemahan equalisasi histogram:
histogram hasil tidak bisa dibentuk sesuai kebutuhan
• Kadangkala dibutuhkan untuk lebih
menonjolkan rentang gray level tertentu pada citra � spesifikasi histogram
52
IF-UTAMA 4/4/2012
14
Operasi spesifikasi histogram
1. Buat histogram dari citra asli
2. Transformasikan histogram citra asli menjadi histogram dengan distribusi seragam
3. Tentukan fungsi trasformasi sesuai spesifikasi histogram yang diinginkan
4. Ubah nilai tiap pixel sesuai dengan nilai hasil pemetaan (histogram asli � histogram equalisasi � histogram hasil)
53
Algoritma: citra 512 x 512 pixel 256 graylevel
Var x,y,i,minval,minj,j : integer; Histspec : array[0..255] of integer;Invhist : array[0..255] of integer; Sum : real;
BeginHist_Equalization(Image) {equalisasi histogram}
For i:= 0 to 255 do {histogram yang dispesifikasikan telah disimpan di spec}
Sum:= 0.0;For j:= 0 to i do Sum := sum + spec[j]
Histspec[i] = round(255 * sum)Endfor {didapat fungsi transformasi}
for i:= 0 to 255 do {pemetaan histogram}
minval := abs(i – histspec[0]; minj := 0;
for j:= 0 to 255 doif abs(i – histspec[j]) < minval then
minval := abs(i – histspec[j])minj := j
endifinvhist[i]:= minj
endforendfor
for y:= 0 to 511 do {ubah nilai tiap pixel pada citra}
for x:= 0 to 511 do image[x,y] = invhist[image(x,y)]
54
Bentuk diskrit spesifikasi histogram: by example
Citra 64x64 pixel, 8 tingkat keabuan dgn distribusi:
rk nk pr(rk)=nk/n
r0=0 790 0,19
r1=1/7 1023 0,25
r2=2/7 850 0,21
r3=3/7 656 0,16
r4=4/7 329 0,08
r5=5/7 245 0,06
r6=6/7 122 0,03
r7=1 81 0,02
Histogram citra:
0
0,05
0,1
0,15
0,2
0,25
0,3
0 1/7 2/7 3/7 4/7 5/7 6/7 1
gray level (rk)
pro
ba
bil
ity (
pr(
r k))
55
Bentuk histogram yang diinginkan
zk pz(zk)
z0=0 0,00
z1=1/7 0,00
z2=2/7 0,00
z3=3/7 0,15
z4=4/7 0,20
z5=5/7 0,30
z6=6/7 0,20
z7=1 0,15
0,00
0,05
0,10
0,15
0,20
0,25
0,30
0,35
0 1/7 2/7 3/7 4/7 5/7 6/7 1
gray level (zk)
pro
bab
ilit
y (
pz(z
k))
56
IF-UTAMA 4/4/2012
15
Langkah 1: equalisasi histogramDidapat hasil:
rj�sk nk ps(sk)
r0�s0=1/7 790 0,19
r1�s1=3/7 1023 0,25
r2�s2=5/7 850 0,21
r3,r4 �s3=6/7 985 0,24
r5,r6,r7 �s4=7/7 448 0,11
0
0,05
0 ,1
0 ,15
0 ,2
0 ,25
0 ,3
0 1/7 2 /7 3 /7 4 /7 5 /7 6 /7 1
g ra y le ve l (sk )
pro
bab
ilit
y (
ps(s
k))
57
Langkah 2: cari fungsi transformasi
∑=
==k
j
jzkk zpzGv0
)()(
� v0 = G(z0) = 0,00
� v1 = G(z1) = 0,00
� v2 = G(z2) = 0,00
� v3 = G(z3) = 0,15
� v4 = G(z4) = 0,35
� v5 = G(z5) = 0,65
� v6 = G(z6) = 0,85
� v7 = G(z7) = 1,00
58
Langkah 1 : Equalisasi
rk nk pr(rk)=nk/n Sk Sk x 7 Normal(Sk)
r0=0 790 0,19 0,19 1,33 ≅ 1 s0=1/7
r1=1/7 1023 0,25 0,44 3,08 ≅ 3 s1=3/7
r2=2/7 850 0,21 0,65 4,55 ≅ 5 s2=5/7
r3=3/7 656 0,16 0,81 5,67 ≅ 6 s3=6/7
r4=4/7 329 0,08 0,89 6,23 ≅ 6 s4=6/7
r5=5/7 245 0,06 0,95 6,65 ≅ 7 s5=7/7
r6=6/7 122 0,03 0,98 6,86 ≅ 7 s6=7/7
r7=1 81 0,02 1,00 7 s7=1
59
Langkah 2: cari fungsi transformasi
zk pz(zk) Vk Vk x 7 Normal(Vk)
z0=0 0,00 0,00 0,00 v0=0
z1=1/7 0,00 0,00 0,00 v1=0
z2=2/7 0,00 0,00 0,00 v2=0
z3=3/7 0,15 0,15 1,05 ≅ 1 v3=1/7
z4=4/7 0,20 0,35 2,45 ≅ 2 v4=2/7
z5=5/7 0,30 0,65 4,45 ≅ 4 v5=4/7
z6=6/7 0,20 0,85 5.95 ≅ 6 v6=6/7
z7=1 0,15 1,00 7 v7=1
Dengan kata lain, lakukan langkah-langkah equalisasi
thd histogram yang diinginkan :
60
IF-UTAMA 4/4/2012
16
Grafik fungsi transformasi
0
0,2
0,4
0,6
0,8
1
1,2
0 1/7 2/7 3/7 4/7 5/7 6/7 1
gray level (zk)
tran
sfo
rmati
on
(v
k)
61
Langkah 3: terapkan inverse G pada level histogram equalisasi
Pemetaan nilai sk ke G(zk) terdekat
� s0 = 1/7 ≈ 0.14 � G(z3) = 0.15; z3 = 3/7
� s1 = 3/7 ≈ 0.43 � G(z4) = 0.35; z4 = 4/7
� s2 = 5/7 ≈ 0.71 � G(z5) = 0.65; z5 = 5/7
� s3 = 6/7 ≈ 0.86 � G(z6) = 0.85; z6 = 6/7
� s4 = 1 � G(z7) = 1.00; z7 = 1
62
Langkah 4: pemetaan dari rk ke zk
• Dengan memperhatikan pemetaan histogram asli ke
histogram equalisasi
� r0 = 0 � z3 = 3/7
� r1 = 1/7 � z4 = 4/7
� r2 = 2/7 � z5 = 5/7
� r3 = 3/7 � z6 = 6/7
� r4 = 4/7 � z6 = 6/7
� r5 = 5/7 � z7 = 1
� r6 = 6/7 � z7 = 1
� r7 = 1 � z7 = 1
63
Histogram hasil
zk nk pz(zk)=nk/n
r0=0 0 0
r1=1/7 0 0
r2=2/7 0 0
r3=3/7 790 0,19
r4=4/7 1023 0,25
r5=5/7 850 0,21
r6=6/7 985 0,24
r7=1 448 0,11
0,00
0,05
0,10
0,15
0,20
0,25
0,30
0 1/7 2/7 3/7 4/7 5/7 6/7 1
gray level (zk)
pro
bab
ilit
y (
pz(z
k))
Histogram hasil mungkin tidak sama persis dengan spesifikasinya � transformasi
hanya akan memberikan hasil yang persis pada kasus kontinyu
64
IF-UTAMA 4/4/2012
17
Contoh 1 spesifikasi histogram
65
Contoh 2 spesifikasi histogram
66
Contoh 3 spesifikasi histogram
67
Contoh cara menspesifikasikan histogram
68
IF-UTAMA 4/4/2012
18
Local enhancement
• Metode equalisasi dan spesifikasi
histogram yg telah dibahas bersifat global (operasi terhadap semua pixel dalam citra)
• Kadang diperlukan enhancement hanya
untuk suatu area tertentu dalam citra
– Adaptasi metode global (equalisasi atau spesifikasi) untuk area N x M pixel
69