Pengertian Grafika Komputer 3 Dimensi


      Grafika komputer 3D (Inggris: 3D Computer graphics) adalah representasi dari data geometrik 3 dimensi sebagai hasil dari pemrosesan dan pemberian efek cahaya terhadap grafika komputer 2D. Hasil ini kadang kala ditampilkan secara waktu nyata (real time) untuk keperluan simulasi. Secara umum prinsip yang dipakai adalah mirip dengan grafika komputer 2D, dalam hal: penggunaan algoritma, grafika vektor, model frame kawat (wire frame model), dan grafika rasternya.
Grafika komputer 3D sering disebut sebagai model 3D. Namun, model 3D ini lebih menekankan pada representasi matematis untuk objek 3 dimensi. Data matematis ini belum bisa dikatakan sebagai gambar grafis hingga saat ditampilkan secara visual pada layar komputer atau printer. Proses penampilan suatu model matematis ke bentuk citra 2 D biasanya dikenal dengan proses 3D rendering.

         Grafika komputer 3D menggunakan matriks 4x4 untuk mengubah dan mentayangkan model 3D dalam bentuk citra 2D. Grafika komputer 3D memiliki 5 jenis dasar matriks transformasi:
Matriks model (Model matrix): Menyimpan orientasi dan posisi model relatif terhadap suatu posisi.
Matriks pandangan (View matrix): Menyimpan transformasi pandangan relatif terhadap posisi asal (yang bernilai (0,0,0)).
Matriks proyeksi (Projection matrix): Menyimpan transformasi untuk mengubah ruang 3D menjadi citra 2D, dan sebaliknya.

Transformasi Matrix :

Matriks dunia (World matrix): Menyimpan orientasi dan posisi suatu posisi relatif terhadap posisi asal.
Matriks lokal (Local matrix): Menyimpan orientasi dan posisi suatu posisi relatif terhadap suatu posisi lain.
Saat penayangan citra, kamera pandangan digunakan sebagai kerangka acuan ruang maya. Apabila kamera harus berpindah (translate) sejarak +10 unit di Poros-Z, maka seluruh model di ruang maya harus berpindah -10 di Poros-Z. Jadi, kamera sebenarnya tidak berpindah, melainkan ruang maya yang berpindah. Setiap benda (termasuk kamera) grafika komputer mempunyai matriks model yang menyimpan posisi dan orientasi model. Sementara, kamera juga memiliki matriks pandangan dan proyeksi. Matriks dunia dan matriks lokal tidak wajib diperlukan, dan bisa dianggap bernilai identitas.

Selain kelima matriks dasar tersebut, juga terdapat matriks-matriks yang merupakan hasil perkalian matriks dasar, contohnya:
Matriks model-pandangan (Model-view matrix)
Matriks model-pandangan-proyeksi (Model-view-projection matrix): Digunakan untuk algoritma perpisahan frustum matriks (Matrix frustum culling).
Matriks dunia-pandangan-proyeksi (World-view-projection matrix): Digunakan di dalam algoritma penayangan citra oleh perangkat lunak shader seperti FX Composer dan RenderMonkey.

  • Perpindahan

          Matriks transformasi untuk perpindahan (translation) adalah sebagai berikut :



  • Rotasi

          Matriks transformasi untuk rotasi Poros-X adalah sebagai berikut :


         Matriks transformasi untuk rotasi Poros-Y adalah sebagai berikut :


         Matriks transformasi untuk rotasi Poros-Z adalah sebagai berikut :



         Matriks transformasi untuk rotasi poros vektor (u,v,w) adalah sebagai berikut:



         Jika vektor memiliki posisi asal (a,b,c), jadi :


  • Skala

         Matriks transformasi skala adalah sebagai berikut :



Sumber : Wikipedia


Buble Sort ( Metode Gelembung )



Ilustrasi buble sort
Ilustrasi buble sort
Pada materi matakuliah struktur data ini, akan dibahasa salah satu metode pengurutan yang paling sederhana yaitu Buble sort (metode gelembung). Pada sesi ini akan dijelaskan tentang:
  • Pengertian/konsep buble sort
  • Kelebihan metode bubble sort
  • Kelemahan metode bubble sort
  • Algoritma buble sort
  • Analisis Algoritma buble sort
  • Implementai bubble sort dalam bahasa C atau C++

Pengertian/Konsep Buble Sort

Metode pengurutan gelembung (Bubble Sort) diinspirasikan oleh gelembung sabun yang berada dipermukaan air. Karena berat jenis gelembung sabun lebih ringan daripada berat jenis air, maka gelembung sabun selalu terapung ke atas permukaan. Prinsip di atas dipakai pada pengurutan gelembung.
Bubble sort (metode gelembung) adalah metode/algoritma pengurutan dengan dengan cara melakukan penukaran data dengan tepat disebelahnya secara terus menerus sampai bisa dipastikan dalam satu iterasi tertentu tidak ada lagi perubahan. Jika tidak ada perubahan berarti data sudah terurut. Disebut pengurutan gelembung karena masing-masing kunci akan dengan lambat menggelembung ke posisinya yang tepat.

Kelebihan Bubble Sort

  • Metode Buble Sort merupakan metode yang paling simpel
  • Metode Buble Sort mudah dipahami algoritmanya

Kelemahan Bubble Sort

Meskipun simpel metode Bubble sort  merupakan metode pengurutanyang paling tidak efisien.  Kelemahan buble sort adalah pada saat mengurutkan data yang sangat besar akan mengalami kelambatan luar biasa, atau dengan kata lain kinerja memburuk cukup signifikan ketika data yang diolah jika  data cukup banyak. Kelemahan lain adalah jumlah pengulangan akan tetap sama jumlahnya walaupun data sesungguhnya sudah cukup terurut. Hal ini disebabkan setiap data dibandingkan dengan setiap data yang lain untuk menentukan posisinya.

Algoritma Bubble Sort

  1. Membandingkan data ke-i dengan data ke-(i+1) (tepat bersebelahan). Jika tidak sesuai maka tukar (data ke-i = data ke-(i+1) dan data ke-(i+1) = data ke-i). Apa maksudnya tidak sesuai? Jika kita menginginkan algoritme menghasilkan data dengan urutan ascending (A-Z) kondisi tidak sesuai adalah data ke-i > data ke-i+1, dan sebaliknya untuk urutan descending (A-Z).
  2. Membandingkan data ke-(i+1) dengan data ke-(i+2). Kita melakukan pembandingan ini sampai data terakhir. Contoh: 1 dgn 2; 2 dgn 3; 3 dgn 4; 4 dgn 5 … ; n-1 dgn n.
  3. Selesai satu iterasi, adalah jika kita sudah selesai membandingkan antara (n-1) dgn n. Setelah selesai satu iterasi kita lanjutkan lagi iterasi berikutnya sesuai dengan aturan ke-1. mulai dari data ke-1 dgn data ke-2, dst.
  4. Proses akan berhenti jika tidak ada pertukaran dalam satu iterasi.

Contoh Kasus Bubble Sort

Misalkan kita punya data seperti ini: 6, 4, 3, 2 dan kita ingin mengurutkan data ini (ascending) dengan menggunakan bubble sort. Berikut ini adalah proses yang terjadi:
Iterasi ke-1: 4, 6, 3, 2 :: 4, 3, 6, 2 :: 4, 3, 2, 6 (ada 3 pertukaran)
Iterasi ke-2: 3, 4, 2, 6 :: 3, 2, 4, 6 :: 3, 2, 4, 6 (ada 2 pertukaran)
Iterasi ke-3: 2, 3, 4, 6 :: 2, 3, 4, 6 :: 2, 3, 4, 6 (ada 1 pertukaran)
Iterasi ke-4: 2, 3, 4, 6 :: 2, 3, 4, 6 :: 2, 3, 4, 6 (ada 0 pertukaran) -> proses selesai

Analisis Algoritma Bubble Sort

Tujuan dari analisis  algoritma adalah untuk  mengetahui efisiensi dari algoritma. Dalam hal ini dilakukan pembandingan antara dua atau lebih algoritma pengurutan.Tahap analisis adalah melakukan pengecekan program untuk memastikan bahwa program telah benar secara logika maupun sintak (tahap tracing atau debugging). Tahap selanjutnya yaitu menjalankan program untuk mengetahui running time atau waktu komputasi dalam hal ini
termasuk jumlah langkah. Data uji yang digunakan adalah data yang tidak terurut atau data random, terurut membesar/, dan terurut mengecil.
Salah satu cara untuk menganalisa kecepatan algoritma sorting saat running time adalah dengan menggunakan notasi Big O. Algoritma  sorting mempunyai kompleksitas waktu terbaik, terburuk, dan rata-rata.  Dengan notasi Big O, kita dapat mengoptimalkan penggunaan algoritma sorting. Sebagai contoh, untuk kasus  dimana jumlah masukan untuk suatu pengurutan banyak, lebih baik digunakan algoritma sorting seperti quick sort, merge sort, atau heap sortkarena kompleksitas waktu untuk kasuk terburuk  adalah  O(n log n). Hal ini tentu akan sangatberbeda jika kita menggunakan algoritma sorting insertion sort atau bubble sort dimana waktu yang dibutuhkan untuk melakukan pencarian akan sangat lama. Hal ini disebabkan kompleksitas waktu terburuk untuk algoritma sorting tersebut dengan jumlah masukan yang banyak adalah O(n2).
Dari grafik dibawah dapat diketahui buble sort adalah metode yang paling lambat dari yang lambat-lambat..heheheh..
Analisis Algoritma Buble Sort
Grafik Metode Pengurutan berode O(n2)

Implementasi Bubble Sort dalam Bahasa C/C++

Berikut ini listing program  atau kode program metode bubble sort dalam bahasa C/C++
#include
void bubbleSort(int data[], int n){
int i, j=0, temp, flag = 1;
while(flag){
flag = 0;
for(i=0; idata[i+1]){
temp = data[i];
data[i] = data[i+1];
data[i+1] = temp;
flag++;
}
}
}
}
main(){
int data[1000];
int n, i;
printf("________.:: BUBBLE SORT :.________\n");
printf("Enter numbers of data(maks 1000): ");
scanf("%d", &n);
printf("Data (separate by space): ");
for(i=0; i


Bingung cara mutusin pacar atau takut gimana ngomong putusnya?

Anda bisa download aplikasi “Putus Cinta” dari iTunes. Aplikasi ini memiliki Beberapa teks menggunakan contoh kata-kata yang menambah kredibilitas, tapi banyak yang malah membuat lelucon dengan alasa-alasan seperti "aku termakan beruang" atau "anggap saja aku mati sebagai seorang pahlawan". Aplikasi “Putus Cinta” ini mendorong pengguna untuk memulai mengakhiri hubungan dan pengguna bisa melakukan modifikasi informasi yang disesuaikan dengan hubungan pengguna dan yang akan diputuskan.
ayo segera  miliki aplikasinya.....!!!!!!!!!!!!!!!!!!!!
































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...