IF-UTAMA
4/4/2012
1
Format File Bitmap
RASTER GRAPHICS
alfeacamia.cmswiki.wikispaces.net/file/view/2.01+Raster+Graphics.ppt
Dosen Pembina : Sriyani Violina, M.T. Danang Junaedi
2
Common Raster Formats
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
• • • • •
GIF JPEG BMP PNG TIFF
Notice the pixels Bitmap enlargement
Image source: http://graphicssoft.about.com/od/aboutgraphics/a/bitmapvector.htm
3
4
1
IF-UTAMA
4/4/2012
GIF – Graphics Interchange Format
JPEG – Joint Photographic Experts Group
Animation – Standard format for animation on the Internet.
X X • • •
• Most common format for: – Text – Clip art, animations, icons, logos
Transparency – yes • Lossless compression • Colors = 256 (8-bit)
Animated Gif
– Simple diagrams, line drawings – Graphics with large blocks of a single color – Graphics with transparent areas – Images displayed on computer screens and on websites.
Animation – No 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
5
BMP - Bitmap
6
PNG – Portable Network Graphics
X Animation – No X Transparency – No • Uncompressed • 256 colors • Large file size - not well suited for transfer across the Internet or for print publications
Icons
• Commonly Used For:
X Animation – no
– Editing raster graphics – Creating icons and wallpaper – On-screen display
Transparency – yes
• Lossless compression • 256 colors – Not suited for photographs
7
• Commonly Used For: – Replacing GIF and TIFF images – Online viewing of images
• See examples at http://graphicssoft.abo ut.com/od/freedownlo ads/l/blfreepng07.htm
8
2
IF-UTAMA
4/4/2012
Demonstration of File Sizes
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
samsclass.info/131/pptF05/ch09.ppt
10
9
BMP File Bitmap •
•
BITMAP • • • 1. pages.towson.edu/hilberg/COSC109/Ch06.ppt 2. Referensi lain yang terkait •
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.
11 12
3
IF-UTAMA
4/4/2012
Bitmaps
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)
Available binary Combinations for Describing a Color
5. 8 bit gray scale (256 shades) 6. 4 bit gray scale (16 shades) 7. 1 bit gray scale (2 shades)
13
14
Device-independent bitmaps and BMP file format
Bitmaps
• 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:
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
BMP File Header
Stores general information about the BMP file.
Bitmap Information (DIB header)
Stores detailed information about the bitmap image.
Color Palette
Stores the definition of the colors being used for indexed color bitmaps.
Bitmap Data
Stores the actual image, pixel by pixel.
16
4
IF-UTAMA
4/4/2012
BMP file header • • • •
Bitmap information (DIB 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#
0000h
Size
Purpose
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 bytes
the offset, i.e. starting address, of the byte where the bitmap data can be found.
Size
Header
Identified by
Supported by the GDI of
12
OS/2 V1
BITMAPCOREH EADER
OS/2 and also all Windows versions since Windows 3.0
64
OS/2 V2
BITMAPCOREH EADER2
40
Windows V3
BITMAPINFOHE ADER
108
Windows V4
BITMAPV4HEAD all Windows versions since ER Windows 95/NT4
124
Windows V5
BITMAPV5HEAD Windows 98/2000 and newer ER
all Windows versions since Windows 3.0
17
BITMAPFILEHEADER Name
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.
18
BITMAPINFOHEADER (Windows 3) (cont’d)
Offset
Size
0
2
bfType
ASCII “BM”
Description
2
4
bfSize
Size of file (in bytes)
6
2
bfReserved1
Zero
Offset
Size
Name
34
4
biSizeImage
Description Size of compressed image (in bytes), zero if uncompressed
8
2
bfReserved2
Zero
38
4
biXPelsPerMeter
Horizontal resolution (pixels/meter)
10
4
bfOffBits
Byte offset in files where image begins
42
4
biYPelsPerMeter
Vertical resolution (pixels/meter)
46
4
biClrUsed
Number of colors used
14
4
biSize
Size of this header (40 bytes)
50
4
biClrImportant
Number of ‘important’ color
18
4
biWidth
Image width in pixels
54
4*N
bmiColors
Color map
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
20
5
IF-UTAMA
4/4/2012
Proses Pembacaan Citra 24 bit
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 21
Proses Penentuan Warna Ke Layar
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
• 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)
23 24
6
IF-UTAMA
4/4/2012
Penentuan Posisi Pixel
Color map
• 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
• 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
B
A
25
Proses Pembacaan Citra 8 bit
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
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)
27
28
7
IF-UTAMA
4/4/2012
Proses Pembacaan Citra 8 bit
Proses Pengambilan Warna dari Color Map
• 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
B
G
R
0
B
G
R
0
COLORMAP
R
G
B
0
56
5
9
1
5
34 67
Berarti untuk pixel 1 intensitas RGB : 56 5 9 Berarti untuk pixel 2 intensitas RGB : 5 34 67
15
5
34 67
Berarti untuk pixel 3 intensitas RGB : 5 34 67
29
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
EQUALISASI HISTOGRAM SPESIFIKASI HISTOGRAM
– 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
32 31
8
IF-UTAMA
4/4/2012
Dua Pendekatan Image Enhancement
Histogram citra
• Metode-metode berbasis domain frekwensi
• Berlaku untuk nilai gray level; RGB per plane warna • Plotting dari persamaan:
– Manipulasi terhadap representasi frekwensi dari citra – Contoh: operasi berbasis transformasi Fourier terhadap citra
p r ( rk ) =
• Metode-metode berbasis domain spasial
– – – –
– Manipulasi langsung terhadap pixel-pixel pada citra – Contoh: operasi histogram
nk ; n
0 ≤ rk ≤ 1 ;
k = 0,1,..., L − 1
L: jumlah level pr(rk): probabilitas kemunculan level ke-k nk: jumlah kemunculan level k pada citra n: total jumlah pixel dalam citra
33
Contoh histogram
34
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
35 36
9
IF-UTAMA
4/4/2012
Equalisasi pada domain kontinyu Histogram :
Ilustrasi equalisasi pada domain kontinyu
dr p s ( s ) = pr ( r ) ds r =T −1 ( s ) r
s = T ( s ) = ∫ pr ( w) dw ;
Transforma si :
0 ≤ r ≤1
0
Uniform : 1 p s ( s ) = pr ( r ) = [1]r =T −1 ( s ) = 1 pr (r ) r =T −1 ( s )
0 ≤ s ≤1
37
Operasi equalisasi histogram
Bentuk diskrit fungsi transformasi k
nj
j =0
n
sk = T (rk ) = ∑
rk = T −1 ( sk )
k
= ∑ pr ( rj ) j =0
38
0 ≤ rk ≤ 1 k = 0,1,..., L − 1
0 ≤ sk ≤ 1
39
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
10
IF-UTAMA
4/4/2012
Contoh
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 do sum:= 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;
Citra 64x64 pixel, 8 tingkat keabuan dgn distribusi: nk
Histogram citra:
pr(rk)=nk/n
0,3
790
0,19
0,25
r1=1/7
1023
0,25
r2=2/7
850
0,21
r3=3/7
656
0,16
r4=4/7
329
0,08
r0=0
probability (p r (rk))
rk
0,2 0,15 0,1
r5=5/7
245
0,06
0,05
r6=6/7
122
0,03
0
81
0,02
r7=1
0
1/7
2/7
3/7
4/7
5/7
6/7
1
gray level (rk)
42 41
Fungsi transformasi
Fungsi transformasi: grafik
0
∑
1,2
p r ( r j ) = p r ( r0 ) = 0 . 19
transformed value (s k)
s 0 = T ( r0 ) =
j=0 1
s1 = T ( r1 ) =
∑p
r
( r j ) = p r ( r0 ) + p r ( r1 ) = 0 . 44
j =0 2
s 2 = T ( r2 ) =
∑
p r ( r j ) = p r ( r0 ) + p r ( r1 ) + p r ( r2 ) = 0 . 65
j=0 3
s 3 = T ( r3 ) =
∑p
4
r
( r j ) = 0 . 81;
s 4 = T ( r4 ) =
j=0
r
( r j ) = 0 . 89
0,8 0,6 0,4 0,2 0 0
1/7
2/7
3/7
4/7
5/7
6/7
1
j=0
5
s 5 = T ( r5 ) =
∑p
1
∑p
gra y le ve l (rk )
6
r
( r j ) = 0 . 95 ;
j=0
s 6 = T ( r6 ) =
∑
p r ( r j ) = 0 . 98
j=0
7
s 7 = T ( r7 ) =
∑ j=0
p r ( r j ) = 1 . 00
43
44
11
IF-UTAMA
4/4/2012
Pembulatan •
Pemetaan
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
• 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 45
Histogram dengan distribusi seragam
Tabel Histogram secara Lengkap
probability (p s(sk))
0,3
Citra 64x64 pixel, 8 tingkat keabuan dgn distribusi:
0,25
rk r0=0
0,2
nk 790
pr(rk)=nk/n
Sk
Sk x 7
0,19
0,19
1,33 ≅ 1
s0=1/7
Normal(Sk)
0,15
r1=1/7
1023
0,25
0,44
3,08 ≅ 3
s1=3/7
0,1
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
81
0,02
1,00
7
0,05 0 0
1/7
2/7
3/7
4/7
5/7
6/7
1
gra y le ve l (sk)
r7=1
Karena histogram merupakan aproksimasi terhadap probability density function, sangat jarang didapat histogram hasil yang betul-betul rata 47
s6=7/7 s7=1
48
12
IF-UTAMA
4/4/2012
Contoh1 equalisasi histogram
Hasil Equalisasi rjsk
nk
ps(sk)
r0s0=1/7
790
0,19
r1s1=3/7
1023
0,25
850
0,21
985
0,24
r5,r6,r7 s4=7/7
448
0,11
0,3 probability (p s(sk))
r2s2=5/7 r3,r4 s3=6/7
0,25 0,2 0,15 0,1 0,05 0 0
1/ 7
2/7
3/7
4/7
5/7
6/7
1
g r a y l e v e l (sk )
49
Contoh 2 equalisasi histogram
50
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
51
52
13
IF-UTAMA
4/4/2012
Operasi spesifikasi histogram
Algoritma: citra 512 x 512 pixel 256 graylevel
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
Var x,y,i,minval,minj,j : integer; Histspec : array[0..255] of integer; Invhist : array[0..255] of integer; Sum : real; Begin Hist_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 do if abs(i – histspec[j]) < minval then minval := abs(i – histspec[j]) minj := j endif invhist[i]:= minj endfor endfor 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
Bentuk histogram yang diinginkan
r0=0
nk
pr(rk)=nk/n
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
zk
Histogram citra:
pz(zk)
0,35 0,30
z0=0
0,00
0,25
z1=1/7
0,00
0,2
z2=2/7
0,00
0,15
z3=3/7
0,15
0,1
z4=4/7
0,20
0,05
z5=5/7
0,30
z6=6/7
0,20
z7=1
0,15
0,3 probability (p r (rk))
rk
0 0
1/7
2/7
3/7
4/7
5/7
6/7
1
gray level (rk)
55
probability (p z (z k))
Citra 64x64 pixel, 8 tingkat keabuan dgn distribusi:
0,25 0,20 0,15 0,10 0,05 0,00 0
1/7
2/7
3/7
4/7
5/7
6/7
1
gray level (zk)
56
14
IF-UTAMA
4/4/2012
Langkah 1: equalisasi histogram
Langkah 2: cari fungsi transformasi
Didapat hasil: rjsk
k
nk
vk = G ( z k ) = ∑ p z ( z j )
ps(sk)
790
0,19
r1s1=3/7
1023
0,25
r2s2=5/7
850
0,21
r3,r4 s3=6/7
985
0,24
r5,r6,r7 s4=7/7
448
0,11
j =0
0,3 probability (p s(sk))
r0s0=1/7
0,25 0,2
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
0,15 0,1 0,05 0 0
1/ 7
2/7
3/7
4/7
5/7
6/7
1
g r a y l e v e l (sk )
58
57
Langkah 1 : Equalisasi rk
Dengan kata lain, lakukan langkah-langkah equalisasi thd histogram yang diinginkan :
pr(rk)=nk/n
Sk
Sk x 7
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
pz(zk)
Vk
Vk x 7
r2=2/7
850
0,21
0,65
4,55 ≅ 5
s2=5/7
z0=0
0,00
0,00
0,00
v0=0
r3=3/7
656
0,16
0,81
5,67 ≅ 6
s3=6/7
z1=1/7
0,00
0,00
0,00
v1=0
r4=4/7
329
0,08
0,89
6,23 ≅ 6
s4=6/7
z2=2/7
0,00
0,00
0,00
z3=3/7
0,15
0,15
1,05 ≅ 1
v3=1/7
r0=0
nk
Langkah 2: cari fungsi transformasi Normal(Sk)
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
zk
s7=1
Normal(Vk)
v2=0
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 v6=6/7
z6=6/7
0,20
0,85
5.95 ≅ 6
z7=1
0,15
1,00
7
v7=1
59 60
15
IF-UTAMA
4/4/2012
Langkah 3: terapkan inverse G pada level histogram equalisasi
Grafik fungsi transformasi transformation (v k)
1,2
Pemetaan nilai sk ke G(zk) terdekat
1
0,8 0,6 0,4 0,2 0 0
1/7
2/7
3/7
4/7
5/7
6/7
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
1
gra y le ve l (z k)
61
62
Histogram hasil
• 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
zk
63
nk
pz(zk)=nk/n
0,30 0,25
r0=0
0
0
r1=1/7
0
0 0
probability (p z(z k))
Langkah 4: pemetaan dari rk ke zk
0,20 0,15
r2=2/7
0
r3=3/7
790
0,19
r4=4/7
1023
0,25
0,05
r5=5/7
850
0,21
0,00
r6=6/7
985
0,24
r7=1
448
0,11
0,10
0
1/7
2/7
3/7
4/7
5/7
6/7
1
gray level (zk)
Histogram hasil mungkin tidak sama persis dengan spesifikasinya transformasi hanya akan memberikan hasil yang persis pada kasus kontinyu 64
16
IF-UTAMA
4/4/2012
Contoh 1 spesifikasi histogram
Contoh 2 spesifikasi histogram
65
66
Contoh cara menspesifikasikan histogram
Contoh 3 spesifikasi histogram
67
68
17
IF-UTAMA
4/4/2012
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
18