• Tidak ada hasil yang ditemukan

LISTING PROGRAM Kode Program Menu Utama: using System;

N/A
N/A
Protected

Academic year: 2019

Membagikan "LISTING PROGRAM Kode Program Menu Utama: using System;"

Copied!
14
0
0

Teks penuh

(1)

LISTING PROGRAM

Kode Program Menu Utama:

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data;

using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms; namespace Harmonic_Mean_Filter {

public partial class utama : Form {

public utama() {

InitializeComponent(); }

private void tambahNoiseToolStripMenuItem_Click(object sender, EventArgs e)

{

tambahnoise frm2 = new tambahnoise(); this.Dispose();

frm2.ShowDialog(); }

private void keluarToolStripMenuItem_Click(object sender, EventArgs e)

{

if (MessageBox.Show("Apakah Anda Ingin Keluar Aplikasi?", "Keluar", MessageBoxButtons.YesNo,

MessageBoxIcon.Question) == DialogResult.Yes) {

Application.Exit(); }

}

private void pengujianToolStripMenuItem_Click(object sender, EventArgs e)

{

Form3 frm3 = new Form3(); this.Dispose();

(2)

private void tentangToolStripMenuItem_Click(object sender, EventArgs e)

{

tentang frm5 = new tentang(); this.Dispose();

frm5.ShowDialog(); }

private void bantuanToolStripMenuItem_Click(object sender, EventArgs e)

{

bantuan frm4 = new bantuan(); this.Dispose();

frm4.ShowDialog(); }

private void label7_Click(object sender, EventArgs e) {

}

private void utama_Load(object sender, EventArgs e) {

}

private void label2_Click(object sender, EventArgs e) {

}

private void pictureBox1_Click(object sender, EventArgs e)

{ } } }

Kode Program Menu Tambah

Noise

:

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data;

using System.Drawing;

using System.Drawing.Imaging; using System.Linq;

(3)

using System.Windows.Forms; using System.IO;

using System.Diagnostics;

using System.Runtime.InteropServices; namespace Harmonic_Mean_Filter

{

public partial class tambahnoise : Form {

BitmapData bmpData = null; byte[] Pixels;

IntPtr point = IntPtr.Zero; private bool bitdeviasi; private double Deviasi; string JenisNoise = ""; public tambahnoise() {

InitializeComponent(); }

private void button6_Click(object sender, EventArgs e) {

utama frm1 = new utama(); this.Dispose();

frm1.ShowDialog(); }

private void button1_Click(object sender, EventArgs e) {

try {

OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image Files(*.bmp)|*.bmp|Image Files(*.jpg)|*.jpg|All Files(*.*)|*.*";

if (open.ShowDialog() == DialogResult.OK) {

Bitmap bit = new Bitmap(open.FileName); citraawal.Image = bit;

long fileSize = new System.IO.FileInfo(open.FileName).Length; if (fileSize / 1000 < 1) {

size.Text = fileSize.ToString(); lblSize.Text = "Byte";

} else {

size.Text = (fileSize / 1000).ToString(); lblSize.Text = "Kb";

(4)

location.Text = Path.GetFullPath(open.FileName); filename.Text =

Path.GetFileName(open.FileName);

height.Text = bit.Height.ToString(); width.Text = bit.Width.ToString(); }

}

catch (Exception) {

throw new ApplicationException("Failed loading image");

} }

private void tambahnoise_Load(object sender, EventArgs e) {

}

private void button3_Click(object sender, EventArgs e) {

Bitmap citra = new Bitmap(citraawal.Image); int x, y, widthPos, HeightPos, randomNumber; double prob;

y = citra.Height; x = citra.Width;

prob = Convert.ToDouble(textBox6.Text); if (prob > 100 || prob < 0)

{

MessageBox.Show("Input Noise hanya antara 0 - 100");

} else {

prob = Convert.ToInt32(x * y * (prob/200)); Random rnd = new Random();

while (prob > 0) {

widthPos = rnd.Next(0, x - 1); HeightPos = rnd.Next(0, y - 1); randomNumber = rnd.Next(1, 10); if (randomNumber <= 5)

{

citra.SetPixel(widthPos, HeightPos, Color.FromArgb(255, 0, 0, 0));

} else {

citra.SetPixel(widthPos, HeightPos, Color.FromArgb(255, 255, 255, 255));

}

(5)

}

citranoise.Image = citra; button4.Enabled = true; button5.Enabled = true;

MessageBox.Show("Noise Salt and Pepper telah berhasil ditambahkan");

JenisNoise = "Salt and Pepper Noise"; }

}

private void button4_Click(object sender, EventArgs e) {

citranoise.Image = null; textBox6.Text = ""; button4.Enabled = false; button5.Enabled = false; }

private void button5_Click(object sender, EventArgs e) {

if (citranoise.Image != null) {

SaveFileDialog simpan = new SaveFileDialog(); simpan.Filter = "Image Files|*.bmp|Image Files|*.png";

simpan.FileName = "*.bmp";

if (simpan.ShowDialog() == DialogResult.OK) {

citranoise.Image.Save(simpan.FileName, System.Drawing.Imaging.ImageFormat.Bmp);

string filename =

simpan.FileName.Substring(0, simpan.FileName.Length - 4) + ".txt";

FileStream fstream = new FileStream(filename, FileMode.OpenOrCreate);

StreamWriter sw = new StreamWriter(fstream); SeekOrigin seekorigin = new SeekOrigin(); sw.BaseStream.Seek(0, seekorigin);

sw.WriteLine(textBox6.Text + "/" + JenisNoise);

sw.Flush(); sw.Close();

MessageBox.Show("Citra Bernoise Telah Disimpan", "Simpan", MessageBoxButtons.OK,

MessageBoxIcon.Information); }

} else {

(6)

}

private double getGaussianNumber() {

Random rnd = new Random(); double v1, v2, persegi; if (bitdeviasi)

{

bitdeviasi = false; return Deviasi * 1; }

do {

// nilai random antara -1.0 and 1.0 v1 = 2 * rnd.NextDouble() - 1; v2 = 2 * rnd.NextDouble() - 1; persegi = v1 * v1 + v2 * v2;

// untuk memastikan dalam satu cakupan }

while (persegi >= 1 || persegi == 0);

var kutup = Math.Sqrt(-2 * Math.Log(persegi) / persegi);

// menyimpan simpangan pertama Deviasi = v2 * kutup;

bitdeviasi = true;

// return kembali ke simp[angan kedua return v1 * kutup;

}

private void button2_Click(object sender, EventArgs e) {

Bitmap citra = new Bitmap(citraawal.Image); int x, y, PixelSize;

double gaussnumber = 0.0; int step, newpixel;

double prob; y = citra.Height; x = citra.Width; PixelSize = x * y;

prob = Convert.ToInt32(textBox6.Text); if (prob > 100 || prob < 0)

{

MessageBox.Show("Input Noise hanya antara 0 - 100");

} else {

Random rnd = new Random();

Rectangle box = new Rectangle(0, 0, x, y); int Depth =

(7)

bmpData = citra.LockBits(box, ImageLockMode.ReadWrite, citra.PixelFormat);

Pixels = new byte[PixelSize * step]; point = bmpData.Scan0;

Marshal.Copy(point, Pixels, 0, Pixels .Length); for (int i = 0; i < Pixels.Length; i+=step)

{

if (i < Pixels.Length - step) {

for (int j = 0; j < step; j++) {

gaussnumber = getGaussianNumber(); newpixel =

Convert.ToInt32(gaussnumber * prob) + Convert.ToInt32(Pixels[i + j]);

if (newpixel < 0) newpixel = 0; if (newpixel > 255) newpixel = 255; Pixels[i + j] =

Convert.ToByte(newpixel); } }

//i += step; }

Marshal.Copy(Pixels, 0, point, Pixels.Length); citra.UnlockBits(bmpData);

citranoise.Image = citra; button4.Enabled = true; button5.Enabled = true;

MessageBox.Show("Noise Gaussian telah berhasil ditambahkan");

JenisNoise = "Gaussian Noise"; }

} } }

Kode Program Menu Reduksi

Noise

:

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data;

using System.Drawing; using System.Linq; using System.Text;

(8)

namespace Harmonic_Mean_Filter

private void groupBox1_Enter(object sender, EventArgs e) {

}

private void label7_Click(object sender, EventArgs e) {

}

(9)

hasilgreen = 0;

private void button1_Click(object sender, EventArgs e) {

private void button3_Click(object sender, EventArgs e) {

(10)

private void button4_Click(object sender, EventArgs e)

private void button5_Click(object sender, EventArgs e) {

utama frm1 = new utama(); this.Dispose();

frm1.ShowDialog(); }

private double hitungMSE(Bitmap imageAsli, Bitmap imageHasil) {

(11)

try {

OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image Files(*.bmp)|*.bmp|Image Files(*.png)|*.png|All Files(*.*)|*.*";

if (open.ShowDialog() == DialogResult.OK) {

Bitmap bit = new Bitmap(open.FileName); imgAwal.Image = bit;

} }

catch (Exception) {

throw new ApplicationException("Failed loading image");

} } } }

Kode Program Menu Bantuan:

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data;

using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms; namespace Harmonic_Mean_Filter {

public partial class bantuan : Form {

public bantuan() {

InitializeComponent(); }

private void kembali4_Click(object sender, EventArgs e) {

utama frm1 = new utama(); this.Dispose();

frm1.ShowDialog(); }

(12)

Kode Program Menu Tentang:

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data;

using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms; namespace Harmonic_Mean_Filter {

public partial class tentang : Form {

public tentang() {

InitializeComponent(); }

private void tentang_Load(object sender, EventArgs e) {

}

private void kembali5_Click(object sender, EventArgs e) {

utama frm1 = new utama(); this.Dispose();

frm1.ShowDialog(); }

(13)

DAFTAR RIWAYAT HIDUP

DATA PRIBADI

Nama Lengkap

: Gamal Nasir

Jenis Kelamin

: Laki-laki

Tempat, Tanggal Lahir

: Banda Aceh, 19 Juli 1992

Alamat

: Jl. Binjai Km.10 Gang. Damai No.35 Deli Serdang

Agama

: Islam

E-mail

: [email protected]

Pendidikan Terakhir

: Universitas Sumatera Utara Medan, Fakultas Ilmu

Komputer dan Teknologi Informasi Jurusan S1

Ilmu Komputer

PENDIDIKAN FORMAL

2009 – 2014

: S1 Ilmu Komputer Universitas Sumatera Utara, Medan

2006 – 2009

: SMA Negeri 15 Medan

2003 – 2006

: SMP Negeri 19 Medan

1997 – 2003

: SD Negeri 101731 Deli Serdang

PENGALAMAN ORGANISASI DAN KEGIATAN ILMIAH

Wakil Ketua OSIS SMP Negeri 19 Medan, 2004-2005

Wakil Ketua PIKIR (Pusat Informasi Reproduksi dan Gender) SMA Negeri 15

Medan 2006-2009

Anggota OSIS SMA Negeri 15 Medan 2007-2009

Anggota Departemen Hubungan Humas Ikatan Mahasiswa S1 Ilmu Komputer

(IMILKOM), 2009-2011

Ketua PORSENI (Pekan Olahraga dan Seni) IMILKOM, 2010-2011

(14)

Ketua Outbond PMB IMILKOM 2011-2012

Anggota PMB PEMA FASILKOM-TI 2012-2013

Ketua Departemen Hubungan Masyarakat Ikatan Mahasiswa S1 Ilmu

Komputer (IMILKOM), 2012-2013

Praktek Kerja Lapangan DISPENDA PROVSU (Dinas Pendapatan Daerah

Referensi

Dokumen terkait

5.The mean scores of post-test cycle 2 were 84 for meaning, 76 for pronunciation, 80 for spelling, and 73 for using words Students’ improvement in teaching and learning

Di access switch tidak ada perintah switchport trunk encapsulation dot1q, karena switch layer dua ini tidak mendukung perintah encapsulation. Untuk pengecekan lakukan perintah

Dari beberapa pengertian diatas dapat disimpulkan dan dapat dipahami bahwa kognitif atau pemikiran adalah istilah yang digunakan oleh ahli psikologi untuk

Derajat bebas distribusi t-student dan keempat parameter GLD yang telah diperoleh akan dipergunakan untuk membentuk kurva fungsi densitas untuk mengetahui kedekatan dari

Tanda baca penutup kalimat atau bagian kalimat ditempatkan di belakang tanda petik yang mengapit kata atau ungkapan yang dipakai dengan arti khusus pada ujung kalimat atau

Berdasarkan pada tabel tersebut diketahui bahwa dari 74 wanita pasangan usia subur di Kelurahan Ngupasan pada tahun 2017 yang menjadi subyek penelitian, terdapat paling

pembelajaran di kelas, yang sangat membosankan oleh karena itu guru harus mengubah pengolahan kelas menjadi suatu pembelajaran yang menyenangkan dan tidak membuat

Pengembangan Program Bahan Ajar Paket A Pasca Melek Aksara (PASMA) dengan Sistem Setoran Kompetensi (SSK) Kelas V (2016) 4.. Pengembangan Program Penilaian Hasil Belajar