Berikut Listing Programnya :



Public Class Form1
    Dim gambar As Bitmap
  
    Private Sub OpenCitraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenCitraToolStripMenuItem.Click
        OFD.Filter = "BMP|*.bmp|JPG|*.Jpg"
        OFD.ShowDialog()
        If OFD.FileName = "" Then Exit Sub
        Pic1.Image = Image.FromFile(OFD.FileName)
        gambar = New Bitmap(Pic1.Image)
    End Sub

    Private Sub SaveCitraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveCitraToolStripMenuItem.Click
        SFD.Filter = "JPG|*.Jpg|BMP|*.bmp"
        SFD.ShowDialog()
        If SFD.FileName = "" Then Exit Sub
        If SFD.FilterIndex = 1 Then
            gambar.Save(SFD.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
        End If
        If SFD.FilterIndex = 2 Then
            gambar.Save(SFD.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
        End If
    End Sub

    Private Sub GrayscaleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GrayscaleToolStripMenuItem.Click
        Dim Pb, Pc As Integer
        Dim Rt, vM, vH, vB As Double
        With gambar
            For Pb = 0 To .Height - 1
                For Pc = 0 To .Width - 1
                    vM = .GetPixel(Pc, Pb).R
                    vH = .GetPixel(Pc, Pb).G
                    vB = .GetPixel(Pc, Pb).B
                    Rt = (vM + vH + vB) / 3
                    .SetPixel(Pc, Pb, Color.FromArgb(Rt, Rt, Rt))

                Next
                Pic2.Image = gambar
                Pic2.Refresh()
            Next
        End With
    End Sub

    Private Sub NegatifToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NegatifToolStripMenuItem.Click
        Dim Pb As Integer
        Dim vM, vH, vB As Double
        With gambar
            For Pb = 0 To .Height - 1
                For Pc = 0 To .Width - 1
                    vM = 225 - .GetPixel(Pc, Pb).R
                    vH = 225 - .GetPixel(Pc, Pb).G
                    vB = 255 - .GetPixel(Pc, Pb).B
                    If vM <= 0 Then vM = 0
                    If vB <= 0 Then vB = 0
                    If vH <= 0 Then vH = 0
                    .SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar
                Pic2.Refresh()
            Next
        End With
    End Sub

    Private Sub BrigthnessToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrigthnessToolStripMenuItem.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
        With gambar
            For Pb = 0 To .Height - 1
                For Pc = 0 To .Width - 1
                    vM = .GetPixel(Pc, Pb).R + 5
                    vH = .GetPixel(Pc, Pb).G + 5
                    vB = .GetPixel(Pc, Pb).B + 5
                    If vM > 255 Then vM = 255
                    If vB > 255 Then vB = 255
                    If vH > 255 Then vH = 255
                    .SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))

                Next
                Pic2.Image = gambar
                Pic2.Refresh()
            Next
        End With
    End Sub

    Private Sub KeluarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KeluarToolStripMenuItem.Click
        End
    End Sub

    Private Sub BinerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BinerToolStripMenuItem.Click
        Dim Pb, Pc As Integer
        Dim rata, vM, vH, vB As Double
        With gambar
            For Pb = 0 To .Height - 1
                For Pc = 0 To .Width - 1
                    vM = .GetPixel(Pc, Pb).R
                    vH = .GetPixel(Pc, Pb).G
                    vB = .GetPixel(Pc, Pb).B
                    rata = (vM + vH + vB) / 3
                    If (rata < 128) Then
                        vM = 0
                        vH = 0
                        vB = 0
                    Else
                        vM = 255
                        vH = 255
                        vB = 255
                    End If
                    .SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar
                Pic2.Refresh()
            Next
        End With
    End Sub

    Private Sub DefaultGambarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefaultGambarToolStripMenuItem.Click
        gambar = New Bitmap(Pic1.Image)
    End Sub

    Private Sub ContrastToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContrastToolStripMenuItem.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
        Dim tc As Integer
        tc = 5
        With gambar
            For Pb = 0 To .Height - 0 - 1
                For Pc = 0 To .Width - 0 - 1
                    vM = .GetPixel(Pc, Pb).R
                    vH = .GetPixel(Pc, Pb).G
                    vB = .GetPixel(Pc, Pb).B
                    'grey = (vM + vH + vB) / 3 'konversi konversi warna pada pixel Pb,Pc ke grey
                    vM = vM * tc
                    vH = vH * tc
                    vB = vB * tc
                    If (vM > 255) Then
                        vM = 255
                    End If
                    If (vH > 255) Then
                        vH = 255
                    End If
                    If (vB > 255) Then
                        vB = 255

                    End If
                    .SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar
                Pic2.Refresh()
            Next
        End With
       
    End Sub
  
    Private Sub Rotasi(ByVal s As RotateFlipType)
        Dim gambar2 = New Bitmap(Pic2.Image)
        Pic2.Image = gambar
        gambar.RotateFlip(s)
        Pic2.Image = gambar
        Pic2.Refresh()
    End Sub
    Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
        Rotasi(RotateFlipType.Rotate90FlipNone)
    End Sub

    Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
        Rotasi(RotateFlipType.Rotate180FlipNone)
    End Sub

    Private Sub ToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem6.Click
        Rotasi(RotateFlipType.Rotate270FlipNone)
    End Sub

    Private Sub FilterSmoothingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilterSmoothingToolStripMenuItem.Click
        Dim bitmap As New Bitmap(Pic1.Image)
        Dim DX As Integer = 1
        Dim DY As Integer = 1
        Dim vM, vH, vB As Integer
        Dim Pb, Pc As Integer
        Dim MF(2, 2) As Double
        'MaskFilter.Show()
        'matriks Filter
        '  0 1 2
        '0 a b c
        '1 d e f
        '2 g h i
        'Filter smoothing
        MF(0, 0) = 1 / 9 'a
        MF(0, 1) = 1 / 9 'b
        MF(0, 2) = 1 / 9 'c
        MF(1, 0) = 1 / 9 'd
        MF(1, 1) = 1 / 9 'e
        MF(1, 2) = 1 / 9 'f
        MF(2, 0) = 1 / 9 'g
        MF(2, 1) = 1 / 9 'h
        MF(2, 2) = 1 / 9 'i

        With gambar
            For Pb = DX To .Height - DX - 1
                For Pc = DY To .Width - DY - 1
                    'proses matriks filter
                    'point(Pc,Pb)*e --> titik tengah
                    vM = CInt(.GetPixel(Pc, Pb).R) * MF(1, 1)
                    vH = CInt(.GetPixel(Pc, Pb).G) * MF(1, 1)
                    vB = CInt(.GetPixel(Pc, Pb).B) * MF(1, 1)
                    'proses titik tetangga
                    'point(Pc-1,Pb-1)*a--> MF(0,0)--> titik kiri atas
                    If Pc - 1 < 1 And Pb - 1 < 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(0, 0))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(0, 0))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(0, 0))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc - 1, Pb - 1).R) * MF(0, 0))
                        vH = vH + (CInt(.GetPixel(Pc - 1, Pb - 1).G) * MF(0, 0))
                        vB = vB + (CInt(.GetPixel(Pc - 1, Pb - 1).B) * MF(0, 0))
                    End If
                    'point(Pc,Pb-1)*b --> MF(0,1) --> titik atas
                    If Pb - 1 < 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(0, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(0, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(0, 1))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc, Pb - 1).R) * MF(0, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb - 1).G) * MF(0, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb - 1).B) * MF(0, 1))
                    End If
                    'point(Pc+1,Pb-1)*c --> MF(0,2) --> titik kanan atas
                   If Pc + 1 > .Width - DY - 1 And Pb - 1 > 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(0, 2))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(0, 2))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(0, 2))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc + 1, Pb - 1).R) * MF(0, 2))
                        vH = vH + (CInt(.GetPixel(Pc + 1, Pb - 1).G) * MF(0, 2))
                        vB = vB + (CInt(.GetPixel(Pc + 1, Pb - 1).B) * MF(0, 2))
                    End If
                    'point(Pc-1,Pb)*d --> MF(1,0) --> titik kiri
                    If Pc - 1 < 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(1, 0))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(1, 0))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(1, 0))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc - 1, Pb).R) * MF(1, 0))
                        vH = vH + (CInt(.GetPixel(Pc - 1, Pb).G) * MF(1, 0))
                        vB = vB + (CInt(.GetPixel(Pc - 1, Pb).B) * MF(1, 0))
                    End If
                    'point(Pc+1,Pb)*f --> MF(1,2) --> titik kanan 
                    If Pc + 1 > .Width - DY - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(1, 2))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(1, 2))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(1, 2))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc + 1, Pb).R) * MF(1, 2))
                        vH = vH + (CInt(.GetPixel(Pc + 1, Pb).G) * MF(1, 2))
                        vB = vB + (CInt(.GetPixel(Pc + 1, Pb).B) * MF(1, 2))
                    End If
                    'point(Pc-1,Pb+1)*g --> MF(2,0) --> titik kiri bawah
                    If Pc - 1 < 1 And Pb + 1 > .Height - DX - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(2, 0))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(2, 0))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(2, 0))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc - 1, Pb + 1).R) * MF(2, 0))
                        vH = vH + (CInt(.GetPixel(Pc - 1, Pb + 1).G) * MF(2, 0))
                        vB = vB + (CInt(.GetPixel(Pc - 1, Pb + 1).B) * MF(2, 0))
                    End If
                    'point(Pc,Pb+1)*g --> MF(2,1) --> titik bawah
                    If Pb + 1 > .Height - DX - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(2, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(2, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(2, 1))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc, Pb + 1).R) * MF(2, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb + 1).G) * MF(2, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb + 1).B) * MF(2, 1))
                    End If
                    'point(Pc+1,Pb+1)*h --> MF(2,2) --> titik kanan bawah
                    If Pc + 1 > .Width - DY - 1 And Pb + 1 > .Height - DX - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(2, 2))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(2, 2))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(2, 2))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc + 1, Pb + 1).R) * MF(2, 2))
                        vH = vH + (CInt(.GetPixel(Pc + 1, Pb + 1).G) * MF(2, 2))
                        vB = vB + (CInt(.GetPixel(Pc + 1, Pb + 1).B) * MF(2, 2))
                    End If
                    'normalisasi
                    If (vM < 0) Then
                        vM = 0
                    Else
                        If (vM > 255) Then
                            vM = 255
                        End If
                    End If
                    If (vH < 0) Then
                        vH = 0
                    Else
                        If (vH > 255) Then
                            vH = 255
                        End If
                    End If
                    If (vB < 0) Then
                        vB = 0
                    Else
                        If (vB > 255) Then
                            vB = 255
                        End If
                    End If
                    'simpan warna hasil smoothing ke point Pc,Pb
                    .SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar
                Pic2.Refresh()
            Next
        End With
    End Sub

    Private Sub WeightedSmoothingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WeightedSmoothingToolStripMenuItem.Click
        Dim tempbmp As New Bitmap(Pic1.Image)
        Dim DX As Integer = 1
        Dim DY As Integer = 1
        Dim vM, vH, vB As Integer
        Dim Pb, Pc As Integer
        Dim MF(2, 2) As Double
        'MaskFilter.Show()
        'matriks Filter
        '  0 1 2
        '0 a b c
        '1 d e f
        '2 g h i
        'Filter smoothing
        MF(0, 0) = 1 / 16 'a
        MF(0, 1) = 2 / 16  'b
        MF(0, 2) = 1 / 16 'c
        MF(1, 0) = 2 / 16 'd
        MF(1, 1) = 4 / 16 'e
        MF(1, 2) = 2 / 16 'f
        MF(2, 0) = 1 / 16 'g
        MF(2, 1) = 2 / 16 'h
        MF(2, 2) = 1 / 16 'i

        With gambar
            For Pb = DX To .Height - DX - 1
                For Pc = DY To .Width - DY - 1
                    'proses matriks filter
                    'point(Pc,Pb)*e --> titik tengah
                    vM = CInt(.GetPixel(Pc, Pb).R) * MF(1, 1)
                    vH = CInt(.GetPixel(Pc, Pb).G) * MF(1, 1)
                    vB = CInt(.GetPixel(Pc, Pb).B) * MF(1, 1)
                    'proses titik tetangga
                    'point(Pc-1,Pb-1)*a--> MF(0,0)--> titik kiri atas
                    If Pc - 1 < 1 And Pb - 1 < 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(0, 0))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(0, 0))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(0, 0))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc - 1, Pb - 1).R) * MF(0, 0))
                        vH = vH + (CInt(.GetPixel(Pc - 1, Pb - 1).G) * MF(0, 0))
                        vB = vB + (CInt(.GetPixel(Pc - 1, Pb - 1).B) * MF(0, 0))
                    End If
                    'point(Pc,Pb-1)*b --> MF(0,1) --> titik atas
                    If Pb - 1 < 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(0, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(0, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(0, 1))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc, Pb - 1).R) * MF(0, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb - 1).G) * MF(0, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb - 1).B) * MF(0, 1))
                    End If
                    'point(Pc+1,Pb-1)*c --> MF(0,2) --> titik kanan atas
                    If Pc + 1 > .Width - DY - 1 And Pb - 1 > 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(0, 2))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(0, 2))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(0, 2))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc + 1, Pb - 1).R) * MF(0, 2))
                        vH = vH + (CInt(.GetPixel(Pc + 1, Pb - 1).G) * MF(0, 2))
                        vB = vB + (CInt(.GetPixel(Pc + 1, Pb - 1).B) * MF(0, 2))
                    End If
                    'point(Pc-1,Pb)*d --> MF(1,0) --> titik kiri
                    If Pc - 1 < 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(1, 0))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(1, 0))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(1, 0))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc - 1, Pb).R) * MF(1, 0))
                        vH = vH + (CInt(.GetPixel(Pc - 1, Pb).G) * MF(1, 0))
                        vB = vB + (CInt(.GetPixel(Pc - 1, Pb).B) * MF(1, 0))
                    End If
                    'point(Pc+1,Pb)*f --> MF(1,2) --> titik kanan 
                    If Pc + 1 > .Width - DY - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(1, 2))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(1, 2))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(1, 2))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc + 1, Pb).R) * MF(1, 2))
                        vH = vH + (CInt(.GetPixel(Pc + 1, Pb).G) * MF(1, 2))
                        vB = vB + (CInt(.GetPixel(Pc + 1, Pb).B) * MF(1, 2))
                    End If
                    'point(Pc-1,Pb+1)*g --> MF(2,0) --> titik kiri bawah
                    If Pc - 1 < 1 And Pb + 1 > .Height - DX - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(2, 0))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(2, 0))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(2, 0))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc - 1, Pb + 1).R) * MF(2, 0))
                        vH = vH + (CInt(.GetPixel(Pc - 1, Pb + 1).G) * MF(2, 0))
                        vB = vB + (CInt(.GetPixel(Pc - 1, Pb + 1).B) * MF(2, 0))
                    End If
                    'point(Pc,Pb+1)*g --> MF(2,1) --> titik bawah
                    If Pb + 1 > .Height - DX - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(2, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(2, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(2, 1))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc, Pb + 1).R) * MF(2, 1))
                        vH = vH + (CInt(.GetPixel(Pc, Pb + 1).G) * MF(2, 1))
                        vB = vB + (CInt(.GetPixel(Pc, Pb + 1).B) * MF(2, 1))
                    End If
                    'point(j+1,i+1)*h --> MF(2,2) --> titik kanan bawah
                    If Pc + 1 > .Width - DY - 1 And Pb + 1 > .Height - DX - 1 Then 'jika out of border ambil nilai tengah/point(x,y)
                        vM = vM + (CInt(.GetPixel(Pc, Pb).R) * MF(2, 2))
                        vH = vH + (CInt(.GetPixel(Pc, Pb).G) * MF(2, 2))
                        vB = vB + (CInt(.GetPixel(Pc, Pb).B) * MF(2, 2))
                    Else
                        vM = vM + (CInt(.GetPixel(Pc + 1, Pb + 1).R) * MF(2, 2))
                        vH = vH + (CInt(.GetPixel(Pc + 1, Pb + 1).G) * MF(2, 2))
                        vB = vB + (CInt(.GetPixel(Pc + 1, Pb + 1).B) * MF(2, 2))
                    End If
                    'normalisasi
                    If (vM < 0) Then
                        vM = 0
                    Else
                        If (vM > 255) Then
                            vM = 255
                        End If
                    End If
                    If (vH < 0) Then
                        vH = 0
                    Else
                        If (vH > 255) Then
                            vH = 255
                        End If
                    End If
                    If (vB < 0) Then
                        vB = 0
                    Else
                        If (vB > 255) Then
                            vB = 255
                        End If
                    End If
                    'simpan warna hasil smoothing ke point Pc,Pb
                    .SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar
                Pic2.Refresh()
            Next
        End With
    End Sub

    Private Sub RedToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedToolStripMenuItem1.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
       Dim gambar2 = New Bitmap(Pic2.Image)

            For Pb = 0 To gambar2.Height - 1
                For Pc = 0 To gambar2.Width - 1
                    vM = gambar2.GetPixel(Pc, Pb).R - 10
                    vH = gambar2.GetPixel(Pc, Pb).G
                    vB = gambar2.GetPixel(Pc, Pb).B
                    If vM <= 0 Then vM = 0
                    gambar2.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar2
                Pic2.Refresh()
            Next
    End Sub

    Private Sub GreenToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GreenToolStripMenuItem1.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
        Dim gambar2 = New Bitmap(Pic2.Image)
            For Pb = 0 To gambar2.Height - 1
                For Pc = 0 To gambar2.Width - 1
                    vM = gambar2.GetPixel(Pc, Pb).R
                    vH = gambar2.GetPixel(Pc, Pb).G - 10
                    vB = gambar2.GetPixel(Pc, Pb).B
                    If vH <= 0 Then vH = 0
                    gambar2.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar2
                Pic2.Refresh()
            Next
     
    End Sub

    Private Sub BlueToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlueToolStripMenuItem.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
        Dim gambar2 = New Bitmap(Pic2.Image)
            For Pb = 0 To gambar2.Height - 1
                For Pc = 0 To gambar.Width - 1
                    vM = gambar2.GetPixel(Pc, Pb).R
                    vH = gambar2.GetPixel(Pc, Pb).G
                    vB = gambar2.GetPixel(Pc, Pb).B - 10
                    If vB <= 0 Then vB = 0
                    gambar2.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar2
                Pic2.Refresh()
            Nex
    End Sub

    Private Sub RedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedToolStripMenuItem.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
        Dim gambar2 = New Bitmap(Pic2.Image)
   
            For Pb = 0 To gambar2.Height - 1
                For Pc = 0 To gambar2.Width - 1
                    vM = gambar2.GetPixel(Pc, Pb).R + 10
                    vH = gambar2.GetPixel(Pc, Pb).G
                    vB = gambar2.GetPixel(Pc, Pb).B
                    If vM >= 255 Then vM = 255
                    gambar.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar2
                Pic2.Refresh()
            Next
    End Sub

    Private Sub GreenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GreenToolStripMenuItem.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
        Dim gambar2 = New Bitmap(Pic2.Image)
            For Pb = 0 To gambar2.Height - 1
                For Pc = 0 To gambar2.Width - 1
                    vM = gambar2.GetPixel(Pc, Pb).R
                    vH = gambar2.GetPixel(Pc, Pb).G + 10
                    vB = gambar2.GetPixel(Pc, Pb).B
                    If vH >= 255 Then vH = 255
                    gambar2.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar2
                Pic2.Refresh()
            Next

    End Sub

    Private Sub BlueToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlueToolStripMenuItem1.Click
        Dim Pb, Pc As Integer
        Dim vM, vH, vB As Double
        Dim gambar2 = New Bitmap(Pic2.Image)
            For Pb = 0 To gambar.Height - 1
                For Pc = 0 To gambar2.Width - 1
                    vM = gambar2.GetPixel(Pc, Pb).R
                    vH = gambar2.GetPixel(Pc, Pb).G
                    vB = gambar2.GetPixel(Pc, Pb).B + 10
                    If vB >= 255 Then vB = 255
                    gambar2.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
                Next
                Pic2.Image = gambar2
                Pic2.Refresh()
            Next
    End Sub
   
End Class




Berikut Hasilnya :

 Tampilan Hasil Grayscale :


 Tampilan Hasil Negatif :


  Tampilan Hasil Brightness :



 Tampilan Hasil Rotate 90 derajat :


  Tampilan Hasil Rotate 180 derajat :


 Tampilan Hasil Rotate 270 derajat :

  Tampilan Hasil Biner :






 Tampilan Hasil Contrast :


 Tampilan Hasil Filter Smoothing :



 Tampilan Hasil Weighted Smoothing :




 Tampilan Hasil Pengurangan warna Merah :




 Tampilan Hasil Pengurangan warna Hijau :




 Tampilan Hasil Pengurangan warna Biru :




 Tampilan Hasil Penambahan warna Merah :



 Tampilan Hasil Penambahan warna Hijau :




 Tampilan Hasil Penambahan warna Biru :


Sekian Postingan saya mengenai Pengolahan Citra Lanjutan, Semoga postingan saya ini berguna dan bermanfaat bagi teman - teman semua...
Amin...


1. From Login





 Listing Program From Login :


Public Class Form1
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        UserName.Text = ""
        Password.Text = ""
        Password.PasswordChar = "*"
    End Sub

    Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click
        If UserName.Text = "Syahril" And Password.Text = "123" Then
            MsgBox("Selamat Datang !")
            Me.Hide()
            MenuUtama.Show()
        Else
            MsgBox("Maaf! Username / Password Salah!")
            UserName.Text = ""
            Password.Text = ""
        End If



    End Sub

    Private Sub BtnKELUAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKELUAR.Click
        End
    End Sub
End Class



2. Menu Utama







Listing Program Menu Utama :


Public Class MenuUtama


   
    Private Sub MenuUtamaToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuUtamaToolStripMenuItem3.Click
        Gambar.MdiParent = Me
        Gambar.Show()
    End Sub

    Private Sub GambarToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GambarToolStripMenuItem4.Click
        End
    End Sub
End Class



3. Pengolahan Citra

 





 Listing Program Pengolahan Citra :


Public Class Gambar
    Private Sub BtnGrayscale_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGrayscale.Click
        Dim rt, pc, pb As Integer
        Dim vm, vh, vB As Integer
        Dim gambar2 As Bitmap
        Picturebox2.Image = picturebox1.Image
        gambar2 = New Bitmap(Picturebox2.Image)
        For pb = 0 To gambar2.Height - 1
            For pc = 0 To gambar2.Width - 1
                vm = gambar2.GetPixel(pc, pb).R
                vh = gambar2.GetPixel(pc, pb).G
                vB = gambar2.GetPixel(pc, pb).B
                rt = (vm + vh + vB) / 3
                gambar2.SetPixel(pc, pb, Color.FromArgb(rt, rt, rt))
            Next
        Next
        Picturebox2.Image = gambar2
        Picturebox2.Refresh()

    End Sub
End Class





Berikut Hasilnya : 

















 





NB : untuk mencari karekter Enkripsi ketikan di kolom Plainteks
        untuk mencari karekter Deskripsi ketikan di kolom  Chiperteks


Listing Programnya :
 

Public Class Form1

    Private Sub BtEnkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEnkripsi.Click
        Dim jumlah As Double = Len(Plainteks.Text)
        Dim x As String
        Dim xkalimat As String = ""
        Dim bil As Integer
        Dim i As Double
        For i = 1 To jumlah
            x = Mid(Plainteks.Text, i, 1)
            bil = Asc(x) + 3
            x = Chr(bil)
            xkalimat = xkalimat + x
        Next i
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Chiperteks.Text = ""
        Plainteks.Text = ""
    End Sub

    Private Sub BtnDiskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDiskripsi.Click
        Dim jumlah As Double = Len(Chiperteks.Text)
        Dim x As String
        Dim xkalimat As String = ""
        Dim bil As Integer
        Dim i As Double
        For i = 1 To jumlah
            x = Mid(Chiperteks.Text, i, 1)
            bil = Asc(x) - 3
            x = Chr(bil)
            xkalimat = xkalimat + x
        Next i
        Plainteks.Text = xkalimat
    End Sub
End Class


Berikut Hasilnya :


 Hasil Gambar untuk Enkripsi






 Hasil Gambar untuk Deskripsi