Rabu, 14 Maret 2012
Tugas Pengolahan citra
Tugas Pengolah Citra
Risya Saumi R (0609u091)
Membuat Neighbourhood :Min, Max, Median, Biner
Coding Biner : If PicAda = False Then
MsgBox("Pilih dulu gambar yang akan diproses", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Error Proses")
Exit Sub
End If
bmap = New Bitmap(picAwal.Image) 'Gambar asli dijadikan gambar Bitmap
picAwal.Image = bmap
Dim tempbmp As New Bitmap(picAwal.Image) 'deklarasi gambar Bitmap dari gambar asli untuk diproses
Dim DX As Integer = 1
Dim DY As Integer = 1
Dim Red As Integer, Green As Integer, Blue As Integer, Grey As Integer
Dim X, Y As Integer
ProgressBar1.Width = picAwal.Width
ProgressBar1.Show()
With tempbmp
For X = DX To .Height - DX - 1
For Y = DY To .Width - DY - 1
Red = CInt(.GetPixel(Y, X).R) 'ambil nilai warna merah (Red) pada pixel(Y,X)
Green = CInt(.GetPixel(Y, X).G) 'ambil nilai warna hijau (Green) pada pixel(Y,X)
Blue = CInt(.GetPixel(Y, X).B) 'ambil nilai warna biru (Blue) pada pixel(Y,X)
Grey = (Red + Green + Blue) / 3 'konversi warna pada pixel Y,X ke grey
If (Grey < 128) Then
Red = 0
Green = 0
Blue = 0
Else
Red = 255
Green = 255
Blue = 255
End If
bmap.SetPixel(Y, X, Color.FromArgb(Red, Green, Blue)) 'simpan warna baru pada pixel(Y,X)
Next
If X Mod 10 = 0 Then
picAwal.Invalidate()
Me.Text = "Progres Proses Biner : " & Int(100 * X / (picAwal.Image.Height - 2)).ToString & "%"
ProgressBar1.Value = Int(100 * X / (picAwal.Image.Height - 2))
picAwal.Refresh()
End If
Next
End With
ProgressBar1.Hide()
picAwal.Refresh()
Me.Text = "Pengolahan Citra : Proses Biner berhasil"
ket: untuk yg lainya saya bikin link bu :))
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar