LAPORAN 5 Brightness

24
LAPORAN PRAKTIKUM PENGOLAHAN CITRA DIGITAL PERBAIKAN CITRA ( ENHANCEMENT 2 ) Oleh : PROGRAM STUDI TEKNIK INFORMATIKA JURUSAN TEKNOLOGI INFORMSASI DAN KOMPUTER TAHUN 2015 Nama : Hadi Mulya NIM : 1257301055 Kelas : G3.1 DosenPembimbing : Sila Abdulla Syakri,S.T.,M.T.

description

Pengolahan citra

Transcript of LAPORAN 5 Brightness

Page 1: LAPORAN 5 Brightness

LAPORAN PRAKTIKUM

PENGOLAHAN CITRA DIGITAL

PERBAIKAN CITRA ( ENHANCEMENT 2 )

Oleh :

PROGRAM STUDI TEKNIK INFORMATIKA

JURUSAN TEKNOLOGI INFORMSASI DAN KOMPUTER

TAHUN 2015

Nama : Hadi Mulya

NIM : 1257301055

Kelas : G3.1

DosenPembimbing : Sila Abdulla Syakri,S.T.,M.T.

Page 2: LAPORAN 5 Brightness
Page 3: LAPORAN 5 Brightness

i

LEMBAR PENGESAHAN

No. Praktikum : 04/TI/PCD/G3.1/2015

Judul : Perbaikan Citra (Enhancement 2)

Nama : Hadi Mulya

NIM : 1257301055

Kelas : G-3

Jurusan : Teknik Elektro

Prodi : Teknik Informatika

Tanggal praktikum : 31 Maret 2015

Tanggal penyerahan : 7 April 2015

Nilai :

Buketrata, 7 April 2015

Dosen Pembimbing,

Sila Abdulla Syakri,S.T.,M.T.

Page 4: LAPORAN 5 Brightness

ii

DAFTAR ISI

LEMBAR PENGESAHAN ...................................................................................... i

DAFTAR ISI ............................................................................................................ii

DAFTAR GAMBAR ................................................. Error! Bookmark not defined.

DAFTAR TABEL ................................................................................................... iv

PERBAIKAN CITRA ( ENHANCEMENT 2 ) ..................................................... 1

5.1 TUJUAN ..................................................................................................... 1

5.2 DASAR TEORI BRIGHTNESS .............................................................. 1

5.3 TUGAS PENDAHULUAN ....................................................................... 1

5.4 PERCOBAAN ............................................................................................ 2

5.4.1 Percobaan Brightness ........................................................................... 2

5.5 TUGAS PADA VB.net .............................................................................. 5

5.6 ANALISA ................................................................................................. 15

5.8 KESIMPULAN ................................................................................................ 16

DAFTAR PUSTAKA ............................................................................................ 16

Page 5: LAPORAN 5 Brightness

iii

DAFTAR GAMBAR

Gambar 5.1 Form untuk Brightness ..................................................................... 2

Gambar 5.2 Hasil Brightness ................................................................................. 5

Gambar 5.3 Form untuk Brightness untuk kondisi negatif ............................... 7

Gambar 5.4 Form untuk Brightness kondisi positif ............................................ 8

Gambar 5.5 Hasil Brightness ............................................................................... 14

Gambar 5.6 Hasil Brightness Merah .................................................................. 14

Gambar 5.8 Hasil Brightness Biru ...................................................................... 15

Page 6: LAPORAN 5 Brightness

iv

DAFTAR TABEL

Tabel 4.1. Tabel Isian Form Untuk Biner ............... Error! Bookmark not defined.

Tabel 4.2 Tabel Isian Form Untuk Histogram ....... Error! Bookmark not defined.

Tabel 4.3. Tabel Isian Form Untuk Biner ............... Error! Bookmark not defined.

Page 7: LAPORAN 5 Brightness
Page 8: LAPORAN 5 Brightness

1

PRAKTIKUM 5

PERBAIKAN CITRA ( ENHANCEMENT 2 )

5.1 TUJUAN

1. Mahasiswa dapat membuat program untuk memperjelas Citra (Brightness)

2. Mahasiswa dapat membuat program untuk mengubah Brightness dengan

posisi negative dan positif.

5.2 DASAR TEORI BRIGHTNESS

Brighness adalah proses penambahan kecerahan dari nilai derajat keabuan.

Proses brightness ini dilakukan dengan menambahkan nilai derajat keabuan

dengan suatu nilai penambah. [1]

xb = x + b

ket :

x = adalah nilai derajat keabuan

b = nilai penambah

xb = hasil brightness

5.3 TUGAS PENDAHULUAN

1. Tujuan Praktikum

Mahasiswa dapat membuat program untuk memperjelas

citra(Brightness)

Mahasiswa dapat membuat program untuk mengubah Brighness

dengan posisi negative dan positif

2. Cara mengubah citra menjadi cerah :

Dapat dilakukan dengan cara menambahkan nilai derajat keabuan dengan

suatu nilai penambah, dan dapat dituliskan : xb = x + b

Dimana : x = nilai derajat keabuan

b = nilai penambah

xb = hasil brightnesS

Page 9: LAPORAN 5 Brightness

2

3. Cara mengubah citra menggunakan brightness kondisi positif dan negative :

Untuk mengubah citra ke kondisi positif, maka nilai penambahannya harus

diperbesar. Dan sebaliknya, untuk mengubah ke kondisi negative maka

nilai penambahannya harus diperkecil.

5.4 PERCOBAAN

5.4.1 Percobaan Brightness

1. Membuat project baru seperti gambar 5.1 berikut ini

Gambar 5.1 Form untuk Brightness

2. Mengisi property pada setiap objek dan form sebagai berikut :

Tabel 5.1 Tabel Isian Form untuk program brightness

Objek Property Nilai

Form Name Brightness

Caption Brightness

Picture1 Picture Nama File Gambar Appereance Flat

Page 10: LAPORAN 5 Brightness

3

Picture2 Appereance Flat

Picture3 Appereance Flat

Picture4 Appereance Flat

Command1 Caption Brightness

Command2 Caption Brightness

Hscroll1 Min 0

Max 255

Value 0

3. Mengisi program berikut pada button1(perintah untuk mengubah

brightness citra):

Private Sub Command1_Click()

Picture1.PaintPicture Picture1.Picture, 0, 0, _

Picture1.ScaleWidth, Picture1.ScaleHeight

Picture2.Refresh

Picture2.Cls

Dim h(256) As Integer

bg = Val(HScroll1)

For i = 1 To Picture1.Width Step 15

For j = 1 To Picture1.Height Step 15

warna = Picture1.Point(i, j)

R = warna And RGB(255, 0, 0)

g = Int((warna And RGB(0, 255, 0)) / 256)

b = Int(Int((warna And RGB(0, 0, 255)) / 256) /

256)

x = ((R + g + b) / 3)

xb = x + bg

Picture1.PSet (i, j), RGB(x, x, x)

Picture2.PSet (i, j), RGB(xb, xb, xb)

Next j

Next i

End Sub

4. Pada tombol histogram

Private Sub Command2_Click()

Picture3.Cls

Picture4.Cls

Dim h(256), h1(256) As Integer

For i = 1 To 256

h(i) = 0: h1(i) = 0

Next i

For i = 1 To Picture1.Width Step 15

For j = 1 To Picture1.Height Step 15

warna = Picture1.Point(i, j)

R = warna And RGB(255, 0, 0)

g = Int((warna And RGB(0, 255, 0)) / 256)

Page 11: LAPORAN 5 Brightness

4

b = Int(Int((warna And RGB(0, 0, 255)) / 256) /

256)

x = ((R + g + b) / 3)

h(x + 1) = h(x + 1) + 1

Next j

Next i

For i = 1 To Picture2.Width Step 15

For j = 1 To Picture2.Height Step 15

warna2 = Picture2.Point(i, j)

R = warna2 And RGB(255, 0, 0)

g = Int((warna2 And RGB(0, 255, 0)) / 256)

b = Int(Int((warna2 And RGB(0, 0, 255)) / 256) /

256)

x = ((R + g + b) / 3)

h(x + 1) = h(x + 1) + 1

Next j

Next i

ht2 = Picture1.Height - 150

wp3 = Picture3.Width

wp4 = Picture4.Width

Picture3.Line (0, ht2)-(wp3, ht2), RGB(0, 0, 255)

Picture4.Line (0, ht2)-(wp4, ht2), RGB(0, 0, 255)

For i = 1 To 256

xp = 15 * (i - 1) + 1

Picture3.Line (xp, ht2 - h(i))-(xp, ht2), RGB(255, 0, 0)

Picture4.Line (xp, ht2 - h(i))-(xp, ht2), RGB(255, 0, 0)

Next i

End Sub

3. Hasil yang diperoleh dari program di atas:

Page 12: LAPORAN 5 Brightness

5

Gambar 5.2 Hasil Brightness

5.5 TUGAS PADA VB.net

1. Mengubah program dengan konstras positif dan negative dengan hscroll1

dengan min -127 dan max 127 . Serta membuat histogram. Menjelaskan

antara kondisi negatif dan positif

Listing program pada VB.net

Public Class Form1 Private histogramValues(256) As Integer Private histogramValuesBg(256) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, j, k, xb As Integer Dim r, g, b, x As Double Dim gambar = New Bitmap(PictureBox1.Image) Dim gambar2 As Bitmap = New Bitmap(PictureBox1.Image) k = HScrollBar1.Value For i = gambar.Width - 1 To 0 Step -1 For j = gambar.Height - 1 To 0 Step -1 r = gambar.GetPixel(i, j).R g = gambar.GetPixel(i, j).G b = gambar.GetPixel(i, j).B x = (r + g + b) / 3 xb = x + k If (xb > 255) Then xb = 255 ElseIf (xb < 0) Then xb = 0 End If 'If k < 255 Then k = 255 gambar.SetPixel(i, j, Color.FromArgb(x, x, x)) gambar2.SetPixel(i, j, Color.FromArgb(xb, xb, xb)) Next PictureBox1.Refresh() PictureBox2.Refresh() PictureBox1.Image = gambar PictureBox2.Image = gambar2 Next End Sub Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll

Page 13: LAPORAN 5 Brightness

6

TextBox1.Text = HScrollBar1.Value End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ReDim histogramValues(256) ReDim histogramValuesBg(256) Dim bmp As New Bitmap(PictureBox1.Image, PictureBox1.Width, PictureBox1.Height) PictureBox1.DrawToBitmap(bmp, PictureBox1.ClientRectangle) PictureBox1.Image = bmp For y As Integer = 0 To bmp.Height - 1 For x As Integer = 0 To bmp.Width - 1 Dim r As Integer = bmp.GetPixel(x, y).R Dim g As Integer = bmp.GetPixel(x, y).G Dim b As Integer = bmp.GetPixel(x, y).B Dim Rumus As Single = ((r + g + b) / 3) histogramValues(Rumus + 1) = histogramValues(Rumus + 1) + 1 bmp.SetPixel(x, y, Color.FromArgb(Rumus, Rumus, Rumus)) Next Next PictureBox3.Invalidate() Dim bmpBg As New Bitmap(PictureBox2.Image, PictureBox2.Width, PictureBox2.Height) PictureBox2.DrawToBitmap(bmpBg, PictureBox2.ClientRectangle) PictureBox2.Image = bmpBg For y As Integer = 0 To bmpBg.Height - 1 For x As Integer = 0 To bmpBg.Width - 1 Dim r As Integer = bmpBg.GetPixel(x, y).R Dim g As Integer = bmpBg.GetPixel(x, y).G Dim b As Integer = bmpBg.GetPixel(x, y).B Dim Rumus As Single = ((r + g + b) / 3) histogramValuesBg(Rumus + 1) = histogramValuesBg(Rumus + 1) + 1 bmpBg.SetPixel(x, y, Color.FromArgb(Rumus, Rumus, Rumus)) Next Next PictureBox4.Invalidate() End Sub Private Sub PictureBox3_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox3.Paint If histogramValues.Max <= 0 Then Exit Sub Dim h As Integer = PictureBox3.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValues(i) / histogramValues.Max) Dim x As Integer = (PictureBox3.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Black, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub

Page 14: LAPORAN 5 Brightness

7

Private Sub PictureBox4_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox4.Paint If histogramValuesBg.Max <= 0 Then Exit Sub Dim h As Integer = PictureBox4.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValuesBg(i) / histogramValuesBg.Max) Dim x As Integer = (PictureBox4.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Black, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class

Hasil Program

- Kondisi negatif

Gambar 5.3 Form untuk Brightness untuk kondisi negatif

Page 15: LAPORAN 5 Brightness

8

- Kondisi positif

Gambar 5.4 Form untuk Brightness kondisi positif

Jika pada kondisi negative, proses brightness akan menghasilkan citra yang

berwarna abu-abu / cenderung hitam dan hasil histogram akan dipotong pada

bagian akhirnya. Sebaliknya, pada citra positif yang menggunakan proses

brightness akan menghasilkan citra yang samar-samar / cenderung berwarna putih

dan hasil histogram akan dipotong pada bagian awalnya

2. Membuat program pada VB.net dengan tampilan histogram RGB

Listing Program

Public Class Form1 Private histogramValuesR(256) As Integer Private histogramValuesG(256) As Integer Private histogramValuesB(256) As Integer Private histogramValuesRBg(256) As Integer Private histogramValuesGBg(256) As Integer Private histogramValuesBBg(256) As Integer

Page 16: LAPORAN 5 Brightness

9

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim i, j, k, xR, xG, xB As Integer Dim r, g, b As Double Dim gambar = New Bitmap(PictureBox1.Image) Dim gambar2 As Bitmap = New Bitmap(PictureBox1.Image) k = Int(HScrollBar1.Value) For i = gambar.Width - 1 To 0 Step -1 For j = gambar.Height - 1 To 0 Step -1 r = gambar.GetPixel(i, j).R g = gambar.GetPixel(i, j).G b = gambar.GetPixel(i, j).B ' x = (r + g + b) / 3 xR = r + k xG = g + k xB = b + k 'fungsi if sebagai kondisi nilai batas maximum dan minimum If (xR > 255) Or (xG > 255) Or (xB > 255) Then xR = 255 xG = 255 xB = 255 End If If (xR < 0) Or (xG < 0) Or (xB < 0) Then xR = 0 xG = 0 xB = 0 End If

gambar.SetPixel(i, j, Color.FromArgb(r, g, b)) gambar2.SetPixel(i, j, Color.FromArgb(xR, xG, xB))

Next PictureBox1.Refresh() PictureBox2.Refresh() PictureBox1.Image = gambar PictureBox2.Image = gambar2 Next End Sub Private Sub HScrollBar1_Scroll(ByVal sender As Object, ByVal e As ScrollEventArgs) Handles HScrollBar1.Scroll TextBox1.Text = HScrollBar1.Value End Sub Private Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click ReDim histogramValuesR(256) ReDim histogramValuesG(256) ReDim histogramValuesB(256) ReDim histogramValuesRBg(256) ReDim histogramValuesGBg(256) ReDim histogramValuesBBg(256) Dim bmp As New Bitmap(PictureBox1.Image, PictureBox1.Width, PictureBox1.Height) PictureBox1.DrawToBitmap(bmp, PictureBox1.ClientRectangle) For y As Integer = 0 To bmp.Height - 1 For x As Integer = 0 To bmp.Width - 1 Dim r As Integer = bmp.GetPixel(x, y).R Dim g As Integer = bmp.GetPixel(x, y).G

Page 17: LAPORAN 5 Brightness

10

Dim b As Integer = bmp.GetPixel(x, y).B histogramValuesR(r + 1) = histogramValuesR(r + 1) + 1 histogramValuesG(g + 1) = histogramValuesG(g + 1) + 1 histogramValuesB(b + 1) = histogramValuesB(b + 1) + 1 Next Next PictureBox3.Invalidate() PictureBox4.Invalidate() PictureBox5.Invalidate() Dim bmpBg As New Bitmap(PictureBox2.Image, PictureBox2.Width, PictureBox2.Height) PictureBox2.DrawToBitmap(bmpBg, PictureBox2.ClientRectangle) For y As Integer = 0 To bmpBg.Height - 1 For x As Integer = 0 To bmpBg.Width - 1 Dim r As Integer = bmpBg.GetPixel(x, y).R Dim g As Integer = bmpBg.GetPixel(x, y).G Dim b As Integer = bmpBg.GetPixel(x, y).B histogramValuesRBg(r + 1) = histogramValuesRBg(r + 1) + 1 histogramValuesGBg(g + 1) = histogramValuesGBg(g + 1) + 1 histogramValuesBBg(b + 1) = histogramValuesBBg(b + 1) + 1 Next Next PictureBox6.Invalidate() PictureBox7.Invalidate() PictureBox8.Invalidate() End Sub Private Sub PictureBox3_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox3.Paint If histogramValuesR.Max <= 0 Then Exit Sub Dim h As Integer = PictureBox3.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValuesR(i) / histogramValuesR.Max) Dim x As Integer = (PictureBox2.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Red, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub Private Sub PictureBox4_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox4.Paint If histogramValuesG.Max <= 0 Then Exit Sub Dim h As Integer = PictureBox4.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValuesG(i) / histogramValuesG.Max) Dim x As Integer = (PictureBox4.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Green, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub Private Sub PictureBox5_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox5.Paint If histogramValuesB.Max <= 0 Then Exit Sub

Page 18: LAPORAN 5 Brightness

11

Dim h As Integer = PictureBox5.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValuesB(i) / histogramValuesB.Max) Dim x As Integer = (PictureBox2.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Blue, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub Private Sub PictureBox6_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox6.Paint If histogramValuesRBg.Max <= 0 Then Exit Sub Dim h As Integer = PictureBox6.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValuesRBg(i) / histogramValuesRBg.Max) Dim x As Integer = (PictureBox6.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Red, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub Private Sub PictureBox7_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox7.Paint If histogramValuesGBg.Max <= 0 Then Exit Sub Dim h As Integer = PictureBox7.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValuesGBg(i) / histogramValuesGBg.Max) Dim x As Integer = (PictureBox7.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Green, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub Private Sub PictureBox8_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox8.Paint If histogramValuesBBg.Max <= 0 Then Exit Sub Dim h As Integer = PictureBox8.ClientSize.Height For i As Integer = 0 To 255 Step 2 Dim barHeight As Integer = CInt(h * histogramValuesBBg(i) / histogramValuesBBg.Max) Dim x As Integer = (PictureBox8.ClientSize.Width * i) / 256 Using pn As New Pen(Brushes.Blue, 2) e.Graphics.DrawLine(pn, x, h - barHeight, x, h) End Using Next End Sub Private Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button4.Click Dim i, j, k, xR As Integer Dim r, g, b As Double Dim gambar = New Bitmap(PictureBox1.Image) Dim gambar2 As Bitmap = New Bitmap(PictureBox1.Image)

Page 19: LAPORAN 5 Brightness

12

k = HScrollBar1.Value For i = gambar.Width - 1 To 0 Step -1 For j = gambar.Height - 1 To 0 Step -1 r = gambar.GetPixel(i, j).R g = gambar.GetPixel(i, j).G b = gambar.GetPixel(i, j).B ' x = (r + g + b) / 3 xR = r + k 'fungsi if sebagai kondisi nilai batas maximum dan minimum If (xR > 255) Then xR = 255 End If If (xR < 0) Then xR = 0 End If gambar.SetPixel(i, j, Color.FromArgb(r, g, b)) gambar2.SetPixel(i, j, Color.FromArgb(xR, g, b)) Next PictureBox1.Refresh() PictureBox2.Refresh() PictureBox1.Image = gambar PictureBox2.Image = gambar2 Next End Sub Private Sub Button5_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button5.Click Dim i, j, k, xG As Integer Dim r, g, b As Double Dim gambar = New Bitmap(PictureBox1.Image) Dim gambar2 As Bitmap = New Bitmap(PictureBox1.Image) k = HScrollBar1.Value For i = gambar.Width - 1 To 0 Step -1 For j = gambar.Height - 1 To 0 Step -1 r = gambar.GetPixel(i, j).R g = gambar.GetPixel(i, j).G b = gambar.GetPixel(i, j).B ' x = (r + g + b) / 3 xG = g + k 'fungsi if sebagai kondisi nilai batas maximum dan minimum If (xG > 255) Then xG = 255 End If If (xG < 0) Then xG = 0 End If gambar.SetPixel(i, j, Color.FromArgb(r, g, b)) gambar2.SetPixel(i, j, Color.FromArgb(r, xG, b)) Next PictureBox1.Refresh() PictureBox2.Refresh() PictureBox1.Image = gambar PictureBox2.Image = gambar2 Next

Page 20: LAPORAN 5 Brightness

13

End Sub Private Sub Button6_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button6.Click Dim i, j, k, xB As Integer Dim r, g, b As Double Dim gambar = New Bitmap(PictureBox1.Image) Dim gambar2 As Bitmap = New Bitmap(PictureBox1.Image) k = HScrollBar1.Value For i = gambar.Width - 1 To 0 Step -1 For j = gambar.Height - 1 To 0 Step -1 r = gambar.GetPixel(i, j).R g = gambar.GetPixel(i, j).G b = gambar.GetPixel(i, j).B ' x = (r + g + b) / 3 xB = b + k 'fungsi if sebagai kondisi nilai batas maximum dan minimum If (xB > 255) Then xB = 255 End If If (xB < 0) Then xB = 0 End If gambar.SetPixel(i, j, Color.FromArgb(r, g, b)) gambar2.SetPixel(i, j, Color.FromArgb(r, g, xB)) Next PictureBox1.Refresh() PictureBox2.Refresh() PictureBox1.Image = gambar PictureBox2.Image = gambar2 Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class Hasil Program

Page 21: LAPORAN 5 Brightness

14

Gambar 5.5 Hasil Brightness

Brightness warna merah

Gambar 5.6 Hasil Brightness Merah

Brightness warna hijau

Gambar 5.7 Hasil Brightness Hijau

Page 22: LAPORAN 5 Brightness

15

Brightness warna biru

Gambar 5.8 Hasil Brightness Biru

5.6 ANALISA

Page 23: LAPORAN 5 Brightness

16

5.8 KESIMPULAN

DAFTAR PUSTAKA

[1] Fadlisyah, S.Si. 2007.Computer Vision dan Pengolahan Citra. Yogyakarta :

Andi.

[2]Putra, Darma. 2010.Pengolahan Citra Digital. Yogyakarta : Andi.

[3] http://lecturer.eepis-its.edu/~riyanto/citra-bab3.pdf

[4] SuryoKusumo, Ario Drs. 2004. Visual Basic.NET versi 2002 dan

2003.Jakarta :PT.Gramedia, Jakarta

Page 24: LAPORAN 5 Brightness

17