Implementasi Metode Arithmetic Mean Filter Dan Kompresi Citra Menggunakan Metode Run Length Encoding
A-1
LISTING PROGRAM
Kode Program Menu Utama:
using
using
using
using
System;
System.Collections.Generic;
System.Drawing;
System.Windows.Forms;
namespace myProjetct
{
///
/// Description of MainForm.
///
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for
Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
gs e)
void TestingToolStripMenuItemClick(object sender, EventAr
{
Form a=new Testing();
a.ShowDialog();
}
void HelpToolStripMenuItemClick(object sender, EventArgs e)
{
Form c =new Help();
c.ShowDialog();
}
e)
void ExitToolStripMenuItemClick(object sender, EventArgs
{
A-2
DialogResult button= MessageBox.Show("Anda yakin mau
keluar?", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.
Question, MessageBoxDefaultButton.Button2);
if (button==DialogResult.Yes) Application.Exit();
}
}
}
Kode Program Menu Testing
using
using
using
using
using
using
using
using
System;
System.Drawing;
System.Linq;
System.Windows.Forms;
System.Drawing.Imaging;
System.IO;
System.Diagnostics;
System.Runtime.InteropServices;
namespace myProjetct
{
///
/// Description of Testing.
///
public partial class Testing : Form
{
double nilaiAsli, nilaiKompres, nilaiFilter, rasio;
public Testing()
{
//
// The InitializeComponent() call is required for
Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
e)
void ExitToolStripMenuItemClick(object sender, EventArgs
{
DialogResult button = MessageBox.Show("Anda yakin mau
keluar?", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.
Question, MessageBoxDefaultButton.Button2);
if (button == DialogResult.Yes) Application.Exit();
}
A-3
e)
void HomeToolStripMenuItemClick(object sender, EventArgs
{
Form a = new MainForm();
this.Dispose();
a.ShowDialog();
}
e)
void HelpToolStripMenuItemClick(object sender, EventArgs
{
Form b = new Help();
this.Dispose();
b.ShowDialog();
}
void openClick(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image File(.*bmp)|*.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
Bitmap gbr = new Bitmap(open.FileName);
if (gbr.Width panjang)
{
panjang = temp1;
}
if (temp2 > panjang)
{
panjang = temp2;
}
int xii = (int)Math.Sqrt(panjang - 1);
int ret = 0;
Bitmap finalimage = new Bitmap(xii, xii);
for (int i = 0; i < xii; i++)
{
for (int j = 0; j < xii; j++)
{
finalimage.SetPixel(j, i, Color.FromArgb(255,
(int)RED[ret], (int)GREEN[ret], (int)BLUE[ret]));
ret++;
}
}
gbrKompresi.Image = finalimage;
watch.Stop();
A-10
RT2.Text =
Math.Round(Convert.ToDecimal(watch.ElapsedMilliseconds) / 1000, 4)
.ToString() + " Sekon";
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_red_komfil.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_green_komfil.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_blue_komfil.txt", false);
StreamWriter tulis_rr = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\piksel_red_kompres.txt", false);
StreamWriter tulis_gg = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\piksel_green_kompres.txt", false);
StreamWriter tulis_bb = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\array_blue_kompres.txt", false);
for (int i = 0; i < kompressred.Length; i++)
{
tulis_r.Write(kompressred[i].ToString() + "\t");
}
tulis_r.Close();
for (int i = 0; i < kompressgreen.Length; i++)
{
tulis_g.Write(kompressgreen[i].ToString() + "\t");
}
tulis_g.Close();
for (int i = 0; i < kompressblue.Length; i++)
{
tulis_b.Write(kompressblue[i].ToString() + "\t");
}
tulis_b.Close();
for (int i = 0; i < RED.Length; i++)
{
tulis_rr.Write(RED[i].ToString() + "\t");
}
tulis_rr.Close();
for (int i = 0; i < GREEN.Length; i++)
{
tulis_gg.Write(GREEN[i].ToString() + "\t");
}
tulis_gg.Close();
for (int i = 0; i < BLUE.Length; i++)
{
tulis_bb.Write(BLUE[i].ToString() + "\t");
}
tulis_bb.Close();
}
else
A-11
{
}
{
}
MessageBox.Show("Belum ada gambar filtering");
void Button3Click(object sender, EventArgs e)
if (gbrAsli.Image != null)
{
Stopwatch watch = new Stopwatch();
watch.Start();
Bitmap image = new Bitmap(gbrAsli.Image);
int xi = image.Width;
int yi = image.Height;
double red = 0, green = 0, blue = 0;
//array red,green blue yg beda
double[] RED = new double[xi * yi];
double[] GREEN = new double[xi * yi];
double[] BLUE = new double[xi * yi];
//array red green blue kseluruhan
double[] arrayred = new double[xi * yi];
double[] arraygreen = new double[xi * yi];
double[] arrayblue = new double[xi * yi];
int acuan = 0, acuan1 = 0, acuan2 = 0, pos = 0, pos1
= 0, pos2 = 0, jumred = 1, jumgreen = 1, jumblue = 1, temp
= 0, temp1 = 0, temp2 = 0;
//jlh array rgb
double[] kompressred = new double[xi * yi];
double[] kompressgreen = new double[xi * yi];
double[] kompressblue = new double[xi * yi];
double panjang;
for (int i = 0; i < xi; i++)
{
for (int j = 0; j < yi; j++)
{
red = image.GetPixel(j, i).R;
if (red == 0)
red = 255;
green = image.GetPixel(j, i).G;
if (green == 0)
green = 255;
blue = image.GetPixel(j, i).B;
if (blue == 0)
blue = 255;
arrayred[acuan] = red;
arraygreen[acuan] = green;
arrayblue[acuan] = blue;
A-12
//pengecekan red yang sama
//jika tidak sama
if (arrayred[pos] != arrayred[acuan])
{
//menyimpan hasil red yang sama
kompressred[temp] = jumred;
//pengecekan jumlah red lebih dari 3
if (jumred >= 1)
{
//menulis pixel kompress
RED[temp] = arrayred[pos];
}
//variable untuk simpan jumlah kompress
temp++;
//mengembalikan kembali nilai variabel
jumlah red
jumred = 1;
//variable pindah untuk posisi pixel yg
terkompress
}
{
pos = acuan;
//jika sama
else
//menambah nilai kompress
jumred++;
if ((acuan + 1) == (xi * yi))
{
//menyimpan jumlah kompress
kompressred[temp] = jumred + 1;
}
}
acuan++;
if (arraygreen[pos1] != arraygreen[acuan1])
{
kompressgreen[temp1] = jumgreen;
if (jumgreen >= 1)
{
GREEN[temp1] = arraygreen[pos1];
}
}
{
temp1++;
jumgreen = 1;
pos1 = acuan1;
else
//menambah nilai kompress
jumgreen++;
A-13
if ((acuan1 + 1) == (xi * yi))
{
//menyimpan jumlah kompress
kompressgreen[temp1] = jumgreen + 1;
}
}
acuan1++;
if (arrayblue[pos2] != arrayblue[acuan2])
{
kompressblue[temp2] = jumblue;
if (jumblue >= 1)
{
BLUE[temp2] = arrayblue[pos2];
}
}
}
}
temp2++;
jumblue = 1;
pos2 = acuan2;
//jika sama
else
{
//menambah nilai kompress
jumblue++;
//pengecekan akhir pixel
if ((acuan2 + 1) == (xi * yi))
{
//menyimpan jumlah kompress
kompressblue[temp2] = jumblue + 1;
}
}
//variable untuk indek simpan arrayred
acuan2++;
panjang = temp;
if (temp1 > panjang)
{
panjang = temp1;
}
if (temp2 > panjang)
{
panjang = temp2;
}
int xii = (int)Math.Sqrt(panjang - 1);
int ret = 0;
Bitmap finalimage = new Bitmap(xii, xii);
for (int i = 0; i < xii; i++)
{
A-14
for (int j = 0; j < xii; j++)
{
finalimage.SetPixel(j, i, Color.FromArgb(255,
(int)RED[ret], (int)GREEN[ret], (int)BLUE[ret]));
ret++;
}
}
gbrAsliKompres.Image = finalimage;
watch.Stop();
RT3.Text =
Math.Round(Convert.ToDecimal(watch.ElapsedMilliseconds) / 1000, 4)
.ToString() + " Sekon";
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_jlh_red_kompres.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_jlh_green_kompres.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_jlh_blue_kompres.txt", false);
StreamWriter tulis_rr = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_array_red_beda_asli.txt", false);
StreamWriter tulis_gg = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_array_green_beda_asli.txt", false);
StreamWriter tulis_bb = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_array_blue_beda_asli.txt", false);
for (int i = 0; i < kompressred.Length; i++)
{
tulis_r.Write(kompressred[i].ToString() + "\t");
}
tulis_r.Close();
for (int i = 0; i < kompressgreen.Length; i++)
{
tulis_g.Write(kompressgreen[i].ToString() + "\t");
}
tulis_g.Close();
for (int i = 0; i < kompressblue.Length; i++)
{
tulis_b.Write(kompressblue[i].ToString() + "\t");
}
tulis_b.Close();
for (int i = 0; i < RED.Length; i++)
{
A-15
}
}
tulis_rr.Write(RED[i].ToString() + "\t");
}
tulis_rr.Close();
for (int i = 0; i < GREEN.Length; i++)
{
tulis_gg.Write(GREEN[i].ToString() + "\t");
}
tulis_gg.Close();
for (int i = 0; i < BLUE.Length; i++)
{
tulis_bb.Write(BLUE[i].ToString() + "\t");
}
tulis_bb.Close();
else
{
}
MessageBox.Show("Gambar belum dimasukkan");
void Simpan1Click(object sender, EventArgs e)
{
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrFiltering.Image.Save(simpan.FileName, ImageFor
mat.Bmp);
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
}
//tulis
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\gbr_filter_red.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\gbr_filter_green.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\gbr_filter_blue.txt", false);
Bitmap filter = (Bitmap)gbrFiltering.Image;
int[,] gambarasli_r
= new int[1, filter.Width * filter.Height];
int[,] gambarasli_g
A-16
= new int[1, filter.Width * filter.Height];
int[,] gambarasli_b
= new int[1, filter.Width * filter.Height];
gambarasli_r = notepad_merah(filter);
gambarasli_g = notepad_hijau(filter);
gambarasli_b = notepad_biru(filter);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
tulis_b.Close();
}
at.Bmp);
void Simpan2Click(object sender, EventArgs e)
{
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrKompresi.Image.Save(simpan.FileName, ImageForm
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
A-17
}
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\komfil_red.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\komfil_green.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\komfil_blue.txt", false);
Bitmap asli = (Bitmap)gbrKompresi.Image;
int[,] gambarasli_r
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_g
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_b
= new int[1, asli.Width * asli.Height];
gambarasli_r = notepad_merah(asli);
gambarasli_g = notepad_hijau(asli);
gambarasli_b = notepad_biru(asli);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
tulis_b.Close();
}
void Simpan3Click(object sender, EventArgs e)
{
SaveFileDialog simpan = new SaveFileDialog();
A-18
ormat.Bmp);
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrAsliKompres.Image.Save(simpan.FileName, ImageF
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
}
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_kompres_red_asli.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_kompres_green_asli.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_komres_blue_asli.txt", false);
Bitmap asli = (Bitmap)gbrAsliKompres.Image;
int[,] gambarasli_r
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_g
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_b
= new int[1, asli.Width * asli.Height];
gambarasli_r = notepad_merah(asli);
gambarasli_g = notepad_hijau(asli);
gambarasli_b = notepad_biru(asli);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
A-19
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
}
tulis_b.Close();
private void dekompresFilter_Click(object sender, EventArgs e)
{
if (gbrKompresi.Image != null)
{
Stopwatch watch = new Stopwatch();
watch.Start();
double[] kompressred
= new double[gbrKompresi.Image.Width*gbrKompresi.Image.Height];
double[] kompressgreen
= new double[gbrKompresi.Image.Width*gbrKompresi.Image.Height];
double[] kompressblue
= new double[gbrKompresi.Image.Width*gbrKompresi.Image.Height];
double[] jlh_red = new double[1000000];
double[] jlh_green = new double[1000000];
double[] jlh_blue = new double[1000000];
double[] red = new double[1000000];
double[] green = new double[1000000];
double[] blue = new double[1000000];
int a = 0;
StreamReader baca3 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\array_blue_kompres.txt");
StreamReader baca2 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\piksel_green_kompres.txt");
StreamReader baca1 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\piksel_red_kompres.txt");
StreamReader baca4 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_red_komfil.txt");
StreamReader baca5 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_green_komfil.txt");
StreamReader baca6 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_blue_komfil.txt");
StreamWriter tulis_red = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\dekompres_red_filter.txt", false);
StreamWriter tulis_green
A-20
= new StreamWriter(@"D:\\Retri Scrib\\cicilan
program\\Notepad\\dekompres_green_filter.txt", false);
StreamWriter tulis_blue
= new StreamWriter(@"D:\\Retri Scrib\\cicilan
program\\Notepad\\dekompres_blue_filter.txt", false);
kompressred = ambil_nilai(baca1);
kompressgreen = ambil_nilai(baca2);
kompressblue = ambil_nilai(baca3);
jlh_red = ambil_nilai(baca4);
jlh_green = ambil_nilai(baca5);
jlh_blue = ambil_nilai(baca6);
for (int i
= 0; i < gbrKompresi.Image.Width*gbrKompresi.Image.Height; i++)
{
for (int j = 0; j < jlh_red[i]; j++)
{
red[a] = kompressred[i];
a++;
}
}
//MessageBox.Show(red.ToString());
int b = 0;
for (int i
= 0; i < gbrKompresi.Image.Width*gbrKompresi.Image.Height; i++)
{
for (int j = 0; j < jlh_green[i]; j++)
{
green[b] = kompressgreen[i];
b++;
}
}
int c = 0;
for (int i
= 0; i < gbrKompresi.Image.Width*gbrKompresi.Image.Height; i++)
{
for (int j = 0; j < jlh_blue[i]; j++)
{
blue[c] = kompressblue[i];
c++;
}
}
//membuat matriks
int[,] pixel_red
= new int[gbrFiltering.Image.Width , gbrFiltering.Image.Height];
A-21
int[,] pixel_green
= new int[gbrFiltering.Image.Width , gbrFiltering.Image.Height];
int[,] pixel_blue
= new int[gbrFiltering.Image.Width , gbrFiltering.Image.Height];
int indeks = 0;
Bitmap dekompresi
= new Bitmap(gbrFiltering.Image.Width , gbrFiltering.Image.Height)
;
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
pixel_red[j, i] =
Convert.ToInt32(red[indeks]);
pixel_green[j, i] =
Convert.ToInt32(green[indeks]);
pixel_blue[j, i] =
Convert.ToInt32(blue[indeks]);
indeks++;
}
}
//buat gbr
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color newpixel =
Color.FromArgb(255, pixel_red[j,i], pixel_green[j,i], pixel_blue[
j,i]);
dekompresi.SetPixel(j, i, newpixel);
}
}
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color cc = dekompresi.GetPixel(j, i);
int pixel = cc.R;
tulis_red.Write(pixel_red[j,i] + "\t");
}
tulis_red.Write(tulis_red.NewLine);
}
tulis_red.Close();
A-22
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color cc = dekompresi.GetPixel(j, i);
int pixel = cc.G;
tulis_green.Write(pixel_green[j,i] + "\t");
}
tulis_green.Write(tulis_green.NewLine);
}
tulis_green.Close();
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color cc = dekompresi.GetPixel(j, i);
int pixel = cc.B;
tulis_blue.Write(pixel_blue[j,i] + "\t");
}
tulis_blue.Write(tulis_blue.NewLine);
}
tulis_blue.Close();
gbrDekompresiFilter.Image = dekompresi;
watch.Stop();
RT4.Text =
Math.Round(Convert.ToDecimal(watch.ElapsedMilliseconds) / 1000, 4)
.ToString() + " Sekon";
MSE2.Text
= MSE((Bitmap)gbrFiltering.Image, (Bitmap)gbrDekompresiFilter.Ima
ge).ToString();
PSNR2.Text
= PSNR(Convert.ToDouble(MSE2.Text)).ToString();
}
else
{
}
MessageBox.Show("salah");
}
void Simpan4Click(object sender, EventArgs e)
{
A-23
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrDekompresiFilter.Image.Save(simpan.FileName, I
mageFormat.Bmp);
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
}
//tulis
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\gbr_dekompresi_filter_red.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\gbr_dekompresi_filter_green.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\gbr_dekompresi_filter_blue.txt", false);
Bitmap dekompresFilter
= (Bitmap)gbrDekompresiFilter.Image;
int[,] gambarasli_r
= new int[1, dekompresFilter.Width * dekompresFilter.Height];
int[,] gambarasli_g
= new int[1, dekompresFilter.Width * dekompresFilter.Height];
int[,] gambarasli_b
= new int[1, dekompresFilter.Width * dekompresFilter.Height];
gambarasli_r = notepad_merah(dekompresFilter);
gambarasli_g = notepad_hijau(dekompresFilter);
gambarasli_b = notepad_biru(dekompresFilter);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
A-24
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
}
tulis_b.Close();
void OpenKomasClick(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image File(.*bmp)|*.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
Bitmap gbr = new Bitmap(open.FileName);
var fileinfo = new FileInfo(open.FileName);
gbrAsliKompres.SizeMode =
PictureBoxSizeMode.StretchImage;
gbrAsliKompres.ImageLocation = open.FileName;
Bitmap bit = new Bitmap(open.FileName);
ukuran4.Text
= ((fileinfo.Length) / 1024).ToString() + " KB";
nilaiKompres = fileinfo.Length/1024;
height2.Text = bit.Height.ToString();
width2.Text = bit.Width.ToString();
rasio = 100 (((nilaiKompres)/(nilaiAsli))*100);
RK2.Text
= (Math.Round(rasio,2)).ToString() + " %";
gbrAsliKompres.Image = bit;
}
}
void OpenDekomfilClick(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image File(.*bmp)|*.bmp";
if (open.ShowDialog() == DialogResult.OK)
A-25
{
Bitmap gbr = new Bitmap(open.FileName);
var fileinfo = new FileInfo(open.FileName);
gbrDekompresiFilter.SizeMode =
PictureBoxSizeMode.StretchImage;
gbrDekompresiFilter.ImageLocation =
open.FileName;
Bitmap bit = new Bitmap(open.FileName);
ukuran5.Text
= ((fileinfo.Length) / 1024).ToString() + " KB";
height3.Text = bit.Height.ToString();
width3.Text = bit.Width.ToString();
gbrDekompresiFilter.Image = bit;
}
}
B-1
DAFTAR RIWAYAT HIDUP
DATA PRIBADI
Nama Lengkap
: Retri Witra Nastiti
Jenis Kelamin
: Perempuan
Tempat, Tanggal Lahir
: Sei Rotan, 30 Desember 1992
Alamat
: Jl. Nusa Indah , Gg.Kenanga No.060, Kec. Bt.Kuis
Agama
: Islam
E-mail
: [email protected]
Pendidikan Terakhir
: Universitas Sumatera Utara Medan, Fakultas Ilmu
Komputer dan Teknologi Informasi Jurusan S-1 Ilmu
Komputer
PENDIDIKAN FORMAL
2011 – 2015
: S1 Ilmu Komputer Universitas Sumatera Utara, Medan
2009 – 2011
: SMA Negeri 8 Medan
2006 – 2008
: SMP Negeri 1 Percut Sei Tuan
1999 – 2005
: SD Negeri 104230 Batang Kuis
PENGALAMAN ORGANISASI DAN KEGIATAN ILMIAH
Anggota UKMI Al-Khuwarizmi periode 2012-2013
Sekretaris Bidang Kaderisasi UKMI Al-Khuwarizmi tahun 2013
Anggota UKM Sikonek USU tahun 2013-2014
Sekretaris Bidang Kaderisasi KAM Rabbani Fasilkom-TI USU tahun 2014
Sekretaris Departemen Agama Islam PEMA Fasilkom-TI USU tahun 2014
Anggota Majelis Permusyawaratan Mahasiswa Universitas (MPMU) USU tahun 2014
Anggota UKMI Ad-Dakwah USU tahun 2015
B-2
PENGALAMAN PEKERJAAN
Mengajar Privat tahun 2015
Mengajar Ngaji tahun 2015-sekarang
LISTING PROGRAM
Kode Program Menu Utama:
using
using
using
using
System;
System.Collections.Generic;
System.Drawing;
System.Windows.Forms;
namespace myProjetct
{
///
/// Description of MainForm.
///
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for
Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
gs e)
void TestingToolStripMenuItemClick(object sender, EventAr
{
Form a=new Testing();
a.ShowDialog();
}
void HelpToolStripMenuItemClick(object sender, EventArgs e)
{
Form c =new Help();
c.ShowDialog();
}
e)
void ExitToolStripMenuItemClick(object sender, EventArgs
{
A-2
DialogResult button= MessageBox.Show("Anda yakin mau
keluar?", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.
Question, MessageBoxDefaultButton.Button2);
if (button==DialogResult.Yes) Application.Exit();
}
}
}
Kode Program Menu Testing
using
using
using
using
using
using
using
using
System;
System.Drawing;
System.Linq;
System.Windows.Forms;
System.Drawing.Imaging;
System.IO;
System.Diagnostics;
System.Runtime.InteropServices;
namespace myProjetct
{
///
/// Description of Testing.
///
public partial class Testing : Form
{
double nilaiAsli, nilaiKompres, nilaiFilter, rasio;
public Testing()
{
//
// The InitializeComponent() call is required for
Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
e)
void ExitToolStripMenuItemClick(object sender, EventArgs
{
DialogResult button = MessageBox.Show("Anda yakin mau
keluar?", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.
Question, MessageBoxDefaultButton.Button2);
if (button == DialogResult.Yes) Application.Exit();
}
A-3
e)
void HomeToolStripMenuItemClick(object sender, EventArgs
{
Form a = new MainForm();
this.Dispose();
a.ShowDialog();
}
e)
void HelpToolStripMenuItemClick(object sender, EventArgs
{
Form b = new Help();
this.Dispose();
b.ShowDialog();
}
void openClick(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image File(.*bmp)|*.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
Bitmap gbr = new Bitmap(open.FileName);
if (gbr.Width panjang)
{
panjang = temp1;
}
if (temp2 > panjang)
{
panjang = temp2;
}
int xii = (int)Math.Sqrt(panjang - 1);
int ret = 0;
Bitmap finalimage = new Bitmap(xii, xii);
for (int i = 0; i < xii; i++)
{
for (int j = 0; j < xii; j++)
{
finalimage.SetPixel(j, i, Color.FromArgb(255,
(int)RED[ret], (int)GREEN[ret], (int)BLUE[ret]));
ret++;
}
}
gbrKompresi.Image = finalimage;
watch.Stop();
A-10
RT2.Text =
Math.Round(Convert.ToDecimal(watch.ElapsedMilliseconds) / 1000, 4)
.ToString() + " Sekon";
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_red_komfil.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_green_komfil.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_blue_komfil.txt", false);
StreamWriter tulis_rr = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\piksel_red_kompres.txt", false);
StreamWriter tulis_gg = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\piksel_green_kompres.txt", false);
StreamWriter tulis_bb = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\array_blue_kompres.txt", false);
for (int i = 0; i < kompressred.Length; i++)
{
tulis_r.Write(kompressred[i].ToString() + "\t");
}
tulis_r.Close();
for (int i = 0; i < kompressgreen.Length; i++)
{
tulis_g.Write(kompressgreen[i].ToString() + "\t");
}
tulis_g.Close();
for (int i = 0; i < kompressblue.Length; i++)
{
tulis_b.Write(kompressblue[i].ToString() + "\t");
}
tulis_b.Close();
for (int i = 0; i < RED.Length; i++)
{
tulis_rr.Write(RED[i].ToString() + "\t");
}
tulis_rr.Close();
for (int i = 0; i < GREEN.Length; i++)
{
tulis_gg.Write(GREEN[i].ToString() + "\t");
}
tulis_gg.Close();
for (int i = 0; i < BLUE.Length; i++)
{
tulis_bb.Write(BLUE[i].ToString() + "\t");
}
tulis_bb.Close();
}
else
A-11
{
}
{
}
MessageBox.Show("Belum ada gambar filtering");
void Button3Click(object sender, EventArgs e)
if (gbrAsli.Image != null)
{
Stopwatch watch = new Stopwatch();
watch.Start();
Bitmap image = new Bitmap(gbrAsli.Image);
int xi = image.Width;
int yi = image.Height;
double red = 0, green = 0, blue = 0;
//array red,green blue yg beda
double[] RED = new double[xi * yi];
double[] GREEN = new double[xi * yi];
double[] BLUE = new double[xi * yi];
//array red green blue kseluruhan
double[] arrayred = new double[xi * yi];
double[] arraygreen = new double[xi * yi];
double[] arrayblue = new double[xi * yi];
int acuan = 0, acuan1 = 0, acuan2 = 0, pos = 0, pos1
= 0, pos2 = 0, jumred = 1, jumgreen = 1, jumblue = 1, temp
= 0, temp1 = 0, temp2 = 0;
//jlh array rgb
double[] kompressred = new double[xi * yi];
double[] kompressgreen = new double[xi * yi];
double[] kompressblue = new double[xi * yi];
double panjang;
for (int i = 0; i < xi; i++)
{
for (int j = 0; j < yi; j++)
{
red = image.GetPixel(j, i).R;
if (red == 0)
red = 255;
green = image.GetPixel(j, i).G;
if (green == 0)
green = 255;
blue = image.GetPixel(j, i).B;
if (blue == 0)
blue = 255;
arrayred[acuan] = red;
arraygreen[acuan] = green;
arrayblue[acuan] = blue;
A-12
//pengecekan red yang sama
//jika tidak sama
if (arrayred[pos] != arrayred[acuan])
{
//menyimpan hasil red yang sama
kompressred[temp] = jumred;
//pengecekan jumlah red lebih dari 3
if (jumred >= 1)
{
//menulis pixel kompress
RED[temp] = arrayred[pos];
}
//variable untuk simpan jumlah kompress
temp++;
//mengembalikan kembali nilai variabel
jumlah red
jumred = 1;
//variable pindah untuk posisi pixel yg
terkompress
}
{
pos = acuan;
//jika sama
else
//menambah nilai kompress
jumred++;
if ((acuan + 1) == (xi * yi))
{
//menyimpan jumlah kompress
kompressred[temp] = jumred + 1;
}
}
acuan++;
if (arraygreen[pos1] != arraygreen[acuan1])
{
kompressgreen[temp1] = jumgreen;
if (jumgreen >= 1)
{
GREEN[temp1] = arraygreen[pos1];
}
}
{
temp1++;
jumgreen = 1;
pos1 = acuan1;
else
//menambah nilai kompress
jumgreen++;
A-13
if ((acuan1 + 1) == (xi * yi))
{
//menyimpan jumlah kompress
kompressgreen[temp1] = jumgreen + 1;
}
}
acuan1++;
if (arrayblue[pos2] != arrayblue[acuan2])
{
kompressblue[temp2] = jumblue;
if (jumblue >= 1)
{
BLUE[temp2] = arrayblue[pos2];
}
}
}
}
temp2++;
jumblue = 1;
pos2 = acuan2;
//jika sama
else
{
//menambah nilai kompress
jumblue++;
//pengecekan akhir pixel
if ((acuan2 + 1) == (xi * yi))
{
//menyimpan jumlah kompress
kompressblue[temp2] = jumblue + 1;
}
}
//variable untuk indek simpan arrayred
acuan2++;
panjang = temp;
if (temp1 > panjang)
{
panjang = temp1;
}
if (temp2 > panjang)
{
panjang = temp2;
}
int xii = (int)Math.Sqrt(panjang - 1);
int ret = 0;
Bitmap finalimage = new Bitmap(xii, xii);
for (int i = 0; i < xii; i++)
{
A-14
for (int j = 0; j < xii; j++)
{
finalimage.SetPixel(j, i, Color.FromArgb(255,
(int)RED[ret], (int)GREEN[ret], (int)BLUE[ret]));
ret++;
}
}
gbrAsliKompres.Image = finalimage;
watch.Stop();
RT3.Text =
Math.Round(Convert.ToDecimal(watch.ElapsedMilliseconds) / 1000, 4)
.ToString() + " Sekon";
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_jlh_red_kompres.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_jlh_green_kompres.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_jlh_blue_kompres.txt", false);
StreamWriter tulis_rr = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_array_red_beda_asli.txt", false);
StreamWriter tulis_gg = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_array_green_beda_asli.txt", false);
StreamWriter tulis_bb = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_array_blue_beda_asli.txt", false);
for (int i = 0; i < kompressred.Length; i++)
{
tulis_r.Write(kompressred[i].ToString() + "\t");
}
tulis_r.Close();
for (int i = 0; i < kompressgreen.Length; i++)
{
tulis_g.Write(kompressgreen[i].ToString() + "\t");
}
tulis_g.Close();
for (int i = 0; i < kompressblue.Length; i++)
{
tulis_b.Write(kompressblue[i].ToString() + "\t");
}
tulis_b.Close();
for (int i = 0; i < RED.Length; i++)
{
A-15
}
}
tulis_rr.Write(RED[i].ToString() + "\t");
}
tulis_rr.Close();
for (int i = 0; i < GREEN.Length; i++)
{
tulis_gg.Write(GREEN[i].ToString() + "\t");
}
tulis_gg.Close();
for (int i = 0; i < BLUE.Length; i++)
{
tulis_bb.Write(BLUE[i].ToString() + "\t");
}
tulis_bb.Close();
else
{
}
MessageBox.Show("Gambar belum dimasukkan");
void Simpan1Click(object sender, EventArgs e)
{
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrFiltering.Image.Save(simpan.FileName, ImageFor
mat.Bmp);
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
}
//tulis
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\gbr_filter_red.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\gbr_filter_green.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\gbr_filter_blue.txt", false);
Bitmap filter = (Bitmap)gbrFiltering.Image;
int[,] gambarasli_r
= new int[1, filter.Width * filter.Height];
int[,] gambarasli_g
A-16
= new int[1, filter.Width * filter.Height];
int[,] gambarasli_b
= new int[1, filter.Width * filter.Height];
gambarasli_r = notepad_merah(filter);
gambarasli_g = notepad_hijau(filter);
gambarasli_b = notepad_biru(filter);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
tulis_b.Close();
}
at.Bmp);
void Simpan2Click(object sender, EventArgs e)
{
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrKompresi.Image.Save(simpan.FileName, ImageForm
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
A-17
}
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\komfil_red.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\komfil_green.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan program\\Notepad\\komfil_blue.txt", false);
Bitmap asli = (Bitmap)gbrKompresi.Image;
int[,] gambarasli_r
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_g
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_b
= new int[1, asli.Width * asli.Height];
gambarasli_r = notepad_merah(asli);
gambarasli_g = notepad_hijau(asli);
gambarasli_b = notepad_biru(asli);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
tulis_b.Close();
}
void Simpan3Click(object sender, EventArgs e)
{
SaveFileDialog simpan = new SaveFileDialog();
A-18
ormat.Bmp);
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrAsliKompres.Image.Save(simpan.FileName, ImageF
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
}
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_kompres_red_asli.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_kompres_green_asli.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\asli_komres_blue_asli.txt", false);
Bitmap asli = (Bitmap)gbrAsliKompres.Image;
int[,] gambarasli_r
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_g
= new int[1, asli.Width * asli.Height];
int[,] gambarasli_b
= new int[1, asli.Width * asli.Height];
gambarasli_r = notepad_merah(asli);
gambarasli_g = notepad_hijau(asli);
gambarasli_b = notepad_biru(asli);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
A-19
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
}
tulis_b.Close();
private void dekompresFilter_Click(object sender, EventArgs e)
{
if (gbrKompresi.Image != null)
{
Stopwatch watch = new Stopwatch();
watch.Start();
double[] kompressred
= new double[gbrKompresi.Image.Width*gbrKompresi.Image.Height];
double[] kompressgreen
= new double[gbrKompresi.Image.Width*gbrKompresi.Image.Height];
double[] kompressblue
= new double[gbrKompresi.Image.Width*gbrKompresi.Image.Height];
double[] jlh_red = new double[1000000];
double[] jlh_green = new double[1000000];
double[] jlh_blue = new double[1000000];
double[] red = new double[1000000];
double[] green = new double[1000000];
double[] blue = new double[1000000];
int a = 0;
StreamReader baca3 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\array_blue_kompres.txt");
StreamReader baca2 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\piksel_green_kompres.txt");
StreamReader baca1 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\piksel_red_kompres.txt");
StreamReader baca4 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_red_komfil.txt");
StreamReader baca5 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_green_komfil.txt");
StreamReader baca6 = new StreamReader("D:\\Retri
Scrib\\cicilan program\\Notepad\\jlh_blue_komfil.txt");
StreamWriter tulis_red = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\dekompres_red_filter.txt", false);
StreamWriter tulis_green
A-20
= new StreamWriter(@"D:\\Retri Scrib\\cicilan
program\\Notepad\\dekompres_green_filter.txt", false);
StreamWriter tulis_blue
= new StreamWriter(@"D:\\Retri Scrib\\cicilan
program\\Notepad\\dekompres_blue_filter.txt", false);
kompressred = ambil_nilai(baca1);
kompressgreen = ambil_nilai(baca2);
kompressblue = ambil_nilai(baca3);
jlh_red = ambil_nilai(baca4);
jlh_green = ambil_nilai(baca5);
jlh_blue = ambil_nilai(baca6);
for (int i
= 0; i < gbrKompresi.Image.Width*gbrKompresi.Image.Height; i++)
{
for (int j = 0; j < jlh_red[i]; j++)
{
red[a] = kompressred[i];
a++;
}
}
//MessageBox.Show(red.ToString());
int b = 0;
for (int i
= 0; i < gbrKompresi.Image.Width*gbrKompresi.Image.Height; i++)
{
for (int j = 0; j < jlh_green[i]; j++)
{
green[b] = kompressgreen[i];
b++;
}
}
int c = 0;
for (int i
= 0; i < gbrKompresi.Image.Width*gbrKompresi.Image.Height; i++)
{
for (int j = 0; j < jlh_blue[i]; j++)
{
blue[c] = kompressblue[i];
c++;
}
}
//membuat matriks
int[,] pixel_red
= new int[gbrFiltering.Image.Width , gbrFiltering.Image.Height];
A-21
int[,] pixel_green
= new int[gbrFiltering.Image.Width , gbrFiltering.Image.Height];
int[,] pixel_blue
= new int[gbrFiltering.Image.Width , gbrFiltering.Image.Height];
int indeks = 0;
Bitmap dekompresi
= new Bitmap(gbrFiltering.Image.Width , gbrFiltering.Image.Height)
;
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
pixel_red[j, i] =
Convert.ToInt32(red[indeks]);
pixel_green[j, i] =
Convert.ToInt32(green[indeks]);
pixel_blue[j, i] =
Convert.ToInt32(blue[indeks]);
indeks++;
}
}
//buat gbr
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color newpixel =
Color.FromArgb(255, pixel_red[j,i], pixel_green[j,i], pixel_blue[
j,i]);
dekompresi.SetPixel(j, i, newpixel);
}
}
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color cc = dekompresi.GetPixel(j, i);
int pixel = cc.R;
tulis_red.Write(pixel_red[j,i] + "\t");
}
tulis_red.Write(tulis_red.NewLine);
}
tulis_red.Close();
A-22
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color cc = dekompresi.GetPixel(j, i);
int pixel = cc.G;
tulis_green.Write(pixel_green[j,i] + "\t");
}
tulis_green.Write(tulis_green.NewLine);
}
tulis_green.Close();
for (int i = 0; i < gbrFiltering.Image.Width; i++)
{
for (int j
= 0; j < gbrFiltering.Image.Height; j++)
{
Color cc = dekompresi.GetPixel(j, i);
int pixel = cc.B;
tulis_blue.Write(pixel_blue[j,i] + "\t");
}
tulis_blue.Write(tulis_blue.NewLine);
}
tulis_blue.Close();
gbrDekompresiFilter.Image = dekompresi;
watch.Stop();
RT4.Text =
Math.Round(Convert.ToDecimal(watch.ElapsedMilliseconds) / 1000, 4)
.ToString() + " Sekon";
MSE2.Text
= MSE((Bitmap)gbrFiltering.Image, (Bitmap)gbrDekompresiFilter.Ima
ge).ToString();
PSNR2.Text
= PSNR(Convert.ToDouble(MSE2.Text)).ToString();
}
else
{
}
MessageBox.Show("salah");
}
void Simpan4Click(object sender, EventArgs e)
{
A-23
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "image Files| *.bmp";
simpan.FileName = "*.bmp";
if (simpan.ShowDialog() == DialogResult.OK)
{
gbrDekompresiFilter.Image.Save(simpan.FileName, I
mageFormat.Bmp);
MessageBox.Show("gambar sudah
disimpan", "save", MessageBoxButtons.OK, MessageBoxIcon.Informati
on);
}
else
{
MessageBox.Show("gambar tidak tersimpan ");
}
//tulis
StreamWriter tulis_r = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\gbr_dekompresi_filter_red.txt", false);
StreamWriter tulis_g = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\gbr_dekompresi_filter_green.txt", false);
StreamWriter tulis_b = new StreamWriter(@"D:\\Retri
Scrib\\cicilan
program\\Notepad\\gbr_dekompresi_filter_blue.txt", false);
Bitmap dekompresFilter
= (Bitmap)gbrDekompresiFilter.Image;
int[,] gambarasli_r
= new int[1, dekompresFilter.Width * dekompresFilter.Height];
int[,] gambarasli_g
= new int[1, dekompresFilter.Width * dekompresFilter.Height];
int[,] gambarasli_b
= new int[1, dekompresFilter.Width * dekompresFilter.Height];
gambarasli_r = notepad_merah(dekompresFilter);
gambarasli_g = notepad_hijau(dekompresFilter);
gambarasli_b = notepad_biru(dekompresFilter);
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_r.Length; j++)
{
tulis_r.Write(gambarasli_r[i, j].ToString() +
"\t");
}
}
tulis_r.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_g.Length; j++)
{
A-24
tulis_g.Write(gambarasli_g[i, j].ToString() +
"\t");
}
}
tulis_g.Close();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < gambarasli_b.Length; j++)
{
tulis_b.Write(gambarasli_b[i, j].ToString() +
"\t");
}
}
}
tulis_b.Close();
void OpenKomasClick(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image File(.*bmp)|*.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
Bitmap gbr = new Bitmap(open.FileName);
var fileinfo = new FileInfo(open.FileName);
gbrAsliKompres.SizeMode =
PictureBoxSizeMode.StretchImage;
gbrAsliKompres.ImageLocation = open.FileName;
Bitmap bit = new Bitmap(open.FileName);
ukuran4.Text
= ((fileinfo.Length) / 1024).ToString() + " KB";
nilaiKompres = fileinfo.Length/1024;
height2.Text = bit.Height.ToString();
width2.Text = bit.Width.ToString();
rasio = 100 (((nilaiKompres)/(nilaiAsli))*100);
RK2.Text
= (Math.Round(rasio,2)).ToString() + " %";
gbrAsliKompres.Image = bit;
}
}
void OpenDekomfilClick(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image File(.*bmp)|*.bmp";
if (open.ShowDialog() == DialogResult.OK)
A-25
{
Bitmap gbr = new Bitmap(open.FileName);
var fileinfo = new FileInfo(open.FileName);
gbrDekompresiFilter.SizeMode =
PictureBoxSizeMode.StretchImage;
gbrDekompresiFilter.ImageLocation =
open.FileName;
Bitmap bit = new Bitmap(open.FileName);
ukuran5.Text
= ((fileinfo.Length) / 1024).ToString() + " KB";
height3.Text = bit.Height.ToString();
width3.Text = bit.Width.ToString();
gbrDekompresiFilter.Image = bit;
}
}
B-1
DAFTAR RIWAYAT HIDUP
DATA PRIBADI
Nama Lengkap
: Retri Witra Nastiti
Jenis Kelamin
: Perempuan
Tempat, Tanggal Lahir
: Sei Rotan, 30 Desember 1992
Alamat
: Jl. Nusa Indah , Gg.Kenanga No.060, Kec. Bt.Kuis
Agama
: Islam
: [email protected]
Pendidikan Terakhir
: Universitas Sumatera Utara Medan, Fakultas Ilmu
Komputer dan Teknologi Informasi Jurusan S-1 Ilmu
Komputer
PENDIDIKAN FORMAL
2011 – 2015
: S1 Ilmu Komputer Universitas Sumatera Utara, Medan
2009 – 2011
: SMA Negeri 8 Medan
2006 – 2008
: SMP Negeri 1 Percut Sei Tuan
1999 – 2005
: SD Negeri 104230 Batang Kuis
PENGALAMAN ORGANISASI DAN KEGIATAN ILMIAH
Anggota UKMI Al-Khuwarizmi periode 2012-2013
Sekretaris Bidang Kaderisasi UKMI Al-Khuwarizmi tahun 2013
Anggota UKM Sikonek USU tahun 2013-2014
Sekretaris Bidang Kaderisasi KAM Rabbani Fasilkom-TI USU tahun 2014
Sekretaris Departemen Agama Islam PEMA Fasilkom-TI USU tahun 2014
Anggota Majelis Permusyawaratan Mahasiswa Universitas (MPMU) USU tahun 2014
Anggota UKMI Ad-Dakwah USU tahun 2015
B-2
PENGALAMAN PEKERJAAN
Mengajar Privat tahun 2015
Mengajar Ngaji tahun 2015-sekarang