Jumat, 17 Januari 2014

PROGRAM PENCITRAAN

Mesran.Blogspot
Keterangan :



  1. Form Login
  2. Form Menu
  3. Form Pengolahan Citra

Dimulai dari yg pertama, yaitu Form Login. Berikut ini adalah design formnya.

1. Form Login













Setelah design form'nya selesai masuk'kan list program berikut ini.

<List Program>

Public Class FormLogin


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Pass.PasswordChar = "*"

    End Sub

    Private Sub Btn_Ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Ok.Click
        If User.Text = "Steven" And Pass.Text = "18" Then
            MsgBox("Selamat Datang", MsgBoxStyle.Information, "Login Success")
            Me.Hide()
            FormDaftar.Show()
        Else
            MsgBox("Maaf !, Password anda salah !", MsgBoxStyle.Information, "Login Gagal")
            User.Text = ""
            Pass.Text = ""
            User.Focus()
        End If
    End Sub

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





Selanjutnya kita membuat Form Menu. Berikut adalah design form'nya


2. Form Menu



















Setelah selesai dengan form'nya, kita masuk'kan list program'nya.

<List Program>

Public Class FormDaftar

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

    Private Sub PengolahanCitraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PengolahanCitraToolStripMenuItem.Click
        FormCitra.Show()
        Me.Hide()
    End Sub
End Class


Dan yg terakhir adalah Form Pengolahan Citra. Berikut ini adalah tampilan form'nya.


3. Form Pengolahan Citra

























Setelah tampilan form'nya seperti diatas, kita masuk'kan list program'nya.

<List Program>
Public Class FormCitra

    Dim Gambar18 As Bitmap



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = Gambar18.GetPixel(Pc, Pb).R + 10
                Vh = Gambar18.GetPixel(Pc, Pb).G
                Vb = Gambar18.GetPixel(Pc, Pb).B
                If Vm >= 255 Then Vm = 255
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub FormCitra_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox2.Image = PictureBox1.Image
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = Gambar18.GetPixel(Pc, Pb).R - 10
                Vh = Gambar18.GetPixel(Pc, Pb).G
                Vb = Gambar18.GetPixel(Pc, Pb).B
                If Vm <= 0 Then Vm = 0
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim Pb, Pc As Integer
        Dim Rt, Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = Gambar18.GetPixel(Pc, Pb).R
                Vh = Gambar18.GetPixel(Pc, Pb).G
                Vb = Gambar18.GetPixel(Pc, Pb).B
                Rt = (Vm + Vh + Vb) / 3
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Rt, Rt, Rt))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = Gambar18.GetPixel(Pc, Pb).R + 5
                Vh = Gambar18.GetPixel(Pc, Pb).G + 5
                Vb = Gambar18.GetPixel(Pc, Pb).B + 5
                If Vm >= 255 Then Vm = 255
                If Vb >= 255 Then Vb = 255
                If Vh >= 255 Then Vh = 255
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = Gambar18.GetPixel(Pc, Pb).R - 5
                Vh = Gambar18.GetPixel(Pc, Pb).G - 5
                Vb = Gambar18.GetPixel(Pc, Pb).B - 5
                If Vm <= 0 Then Vm = 0
                If Vb <= 0 Then Vb = 0
                If Vh <= 0 Then Vh = 0
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        Dim Gambar19 As Bitmap = New Bitmap(PictureBox1.Image)
        For Pb = Gambar18.Height - 1 To 0 Step -1
            For Pc = Gambar18.Width - 1 To 0 Step -1
                Vm = Gambar18.GetPixel(Pc, Pb).R
                Vh = Gambar18.GetPixel(Pc, Pb).G
                Vb = Gambar18.GetPixel(Pc, Pb).B
                Gambar19.SetPixel(Gambar18.Width - 1 - Pc, Gambar18.Height - 1 - Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar19
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = Gambar18.GetPixel(Pc, Pb).R
                Vh = Gambar18.GetPixel(Pc, Pb).G + 10
                Vb = Gambar18.GetPixel(Pc, Pb).B
                If Vh <= 0 Then Vh = 0
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = Gambar18.GetPixel(Pc, Pb).R
                Vh = Gambar18.GetPixel(Pc, Pb).G - 10
                Vb = Gambar18.GetPixel(Pc, Pb).B
                If Vh >= 255 Then Vh = 255
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Dim Pb, Pc As Integer
        Dim Vm, Vh, Vb As Double
        Gambar18 = New Bitmap(PictureBox2.Image)
        For Pb = 0 To Gambar18.Height - 1
            For Pc = 0 To Gambar18.Width - 1
                Vm = 255 - Gambar18.GetPixel(Pc, Pb).R
                Vh = 255 - Gambar18.GetPixel(Pc, Pb).G
                Vb = 255 - Gambar18.GetPixel(Pc, Pb).B
                If Vm <= 0 Then Vm = 0
                If Vb <= 0 Then Vb = 0
                If Vh <= 0 Then Vh = 0
                Gambar18.SetPixel(Pc, Pb, Color.FromArgb(Vm, Vh, Vb))
            Next
            PictureBox2.Image = Gambar18
            PictureBox2.Refresh()
        Next
    End Sub

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

Tidak ada komentar:

Posting Komentar