Jumat, 17 Januari 2014
Pencitraan
Setelah membuat form seperti di atas masukkan program di bawah ini :
Public Class Form1
Dim gambar2 As Bitmap
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
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
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox2.Image = PictureBox1.Image
End Sub
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
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 - 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
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
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
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 + 10
vh = gambar2.GetPixel(pc, pb).G
vb = gambar2.GetPixel(pc, pb).B
If vm >= 255 Then vm = 255
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
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
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 + 5
vh = gambar2.GetPixel(pc, pb).G + 5
vb = gambar2.GetPixel(pc, pb).B + 5
If vm >= 255 Then vm = 255
If vb >= 255 Then vb = 255
If vh >= 255 Then vh = 255
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
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
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 - 5
vh = gambar2.GetPixel(pc, pb).G - 5
vb = gambar2.GetPixel(pc, pb).B - 5
If vm <= 0 Then vm = 0
If vb <= 0 Then vb = 0
If vh <= 0 Then vh = 0
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
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
gambar2 = New Bitmap(PictureBox2.Image)
Dim gambar3 As Bitmap = New Bitmap(PictureBox1.Image)
For pb = gambar2.Height - 1 To 0 Step -1
For pc = gambar2.Width - 1 To 0 Step -1
vm = gambar2.GetPixel(pc, pb).R
vh = gambar2.GetPixel(pc, pb).G
vb = gambar2.GetPixel(pc, pb).B
gambar3.SetPixel(gambar2.Width - 1 - pc, gambar2.Height - 1 - pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar3
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
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 - 10
vb = gambar2.GetPixel(pc, pb).B
If vh <= 0 Then vh = 0
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
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
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 + 10
vb = gambar2.GetPixel(pc, pb).B
If vh >= 255 Then vh = 255
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
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
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = 255 - gambar2.GetPixel(pc, pb).R
vh = 255 - gambar2.GetPixel(pc, pb).G
vb = 255 - gambar2.GetPixel(pc, pb).B
If vm <= 0 Then vm = 0
If vb <= 0 Then vb = 0
If vh <= 0 Then vh = 0
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
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
Langganan:
Posting Komentar (Atom)
Lucky Nugget Casino - MapyRO
BalasHapusLocated in Las Vegas, Lucky Nugget 춘천 출장샵 Casino is 안성 출장샵 within a 15-minute 경상북도 출장마사지 walk of popular sights such as 군포 출장안마 High Roller and Vicksburg Casino. 영천 출장안마