• Tidak ada hasil yang ditemukan

Implementasi Content Based Video retrieval Menggunakan Speede-Up Robust Features (Surf)

N/A
N/A
Protected

Academic year: 2017

Membagikan "Implementasi Content Based Video retrieval Menggunakan Speede-Up Robust Features (Surf)"

Copied!
19
0
0

Teks penuh

(1)

LISTING PROGRAM

Form Home.cs

using System;

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

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

using System.Threading.Tasks; using System.Windows.Forms; using System.IO;

namespace SURF_Algorithm {

public partial class Form_Home : Form {

public Form_Home() {

InitializeComponent();

this.Closing += (this.Keluar); }

void Keluar(object sender, CancelEventArgs e) {

if (MessageBox.Show("Tutup Aplikasi ?", "Konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) Application.ExitThread();

else

e.Cancel = true; }

private void keluarToolStripMenuItem_Click(object sender, EventArgs e) {

Close(); }

private void videoToolStripMenuItem_Click(object sender, EventArgs e) {

Form_Video FV = new Form_Video(); Hide(); FV.Show();

}

private void Form_Home_Load(object sender, EventArgs e) {

Directory.CreateDirectory(Application.StartupPath + "\\Data"); Directory.CreateDirectory(Application.StartupPath +

"\\Data\\Frame");

Directory.CreateDirectory(Application.StartupPath + "\\Data\\Video");

}

(2)

{

Form_SURF FS = new Form_SURF(); Hide(); FS.Show();

} } }

Form Video.cs

using System;

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

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

using System.Threading.Tasks; using System.Windows.Forms; using System.Data.OleDb; using System.IO;

namespace SURF_Algorithm {

public partial class Form_Video : Form {

public Form_Video() {

InitializeComponent();

this.Closing += (this.Keluar); }

void Keluar(object sender, CancelEventArgs e) {

Form_Home FH = new Form_Home(); FH.Show();

}

private void Form_Video_Load(object sender, EventArgs e) {

Tampil_Data(); }

void Tampil_Data() {

Konfigurasi.Koneksi();

Konfigurasi.DA = new OleDbDataAdapter("SELECT * FROM `Tabel Video` ORDER BY Nama ASC", Konfigurasi.CONN);

Konfigurasi.DS = new DataSet(); Konfigurasi.DS.Clear();

Konfigurasi.DA.Fill(Konfigurasi.DS, "Tabel Video"); DGV.DataSource = Konfigurasi.DS.Tables["Tabel Video"]; DGV.Refresh();

}

private void btn_tambah_Click(object sender, EventArgs e) {

(3)

FTV.ShowDialog(); }

private void btn_hapus_Click(object sender, EventArgs e) {

groupBox2.Text.Replace("Player : ", "") + " ?", "Konfirmasi",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) Video` WHERE Nama = '" + groupBox2.Text.Replace("Player : ", "") + "'", Konfigurasi.CONN);

private void txt_cari_TextChanged(object sender, EventArgs e) {

try {

Konfigurasi.Koneksi();

(4)

private void DGV_CellClick(object sender, DataGridViewCellEventArgs e) {

try {

groupBox2.Text = "Player : " + DGV.Rows[e.RowIndex].Cells[0].Value.ToString();

WMP.URL = DGV.Rows[e.RowIndex].Cells[3].Value.ToString(); }

catch {

} }

private void btn_reload_Click(object sender, EventArgs e) {

Tampil_Data(); }

private void DGV_CellContentClick(object sender, DataGridViewCellEventArgs e)

{

} }}

Form Tambah Video.cs

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; using System.Threading; using Emgu.CV;

using Emgu.CV.Structure; using Emgu.Util;

using System.Drawing.Imaging; using System.IO;

using System.Data.OleDb;

namespace SURF_Algorithm {

public partial class Form_Tambah_Video : Form {

private Capture _capture = null; Image<Bgr, Byte> frame;

(5)

string Tnama, Tdurasi, Tframe, Tlokasi, TLFrame;

public Form_Tambah_Video() {

InitializeComponent(); }

private void ReleaseData() {

if (_capture != null) _capture.Dispose(); }

private void ProcessFrame(object sender, EventArgs arg) {

try {

Framesno =

_capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_POS_FRAMES); frame = _capture.QueryFrame();

if (frame != null) {

pictureBox1.Image = frame.ToBitmap();

if (Video_seek.Value + (int)(FrameRate) < Video_seek.Maximum)

{

Video_seek.Value = (int)(Framesno); double time_index =

_capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_POS_MSEC); Time_Label.Text = "Time: " +

TimeSpan.FromMilliseconds(time_index).ToString().Substring(0, 8); double framenumber =

_capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_POS_FRAMES); Frame_lbl.Text = "Frame: " + framenumber.ToString();

SaveImage(framenumber.ToString()); Video_seek.Value += (int)FrameRate;

_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_POS_FRAMES, Video_seek.Value);

}

Thread.Sleep((int)(1000.0 / FrameRate)); }

}

catch (Exception ex) {

MessageBox.Show(ex.Message.ToString()); }

}

public void SaveImage(string frameNumber) {

using (var m = new MemoryStream()) {

pictureBox1.Image.Save(m, ImageFormat.Jpeg);

(6)

var path = TLFrame +

Path.GetFileNameWithoutExtension(openFileDialog1.FileName) + "-" + frameNumber + ".jpg";

img.Save(path); }

}

(7)

_capture.Stop(); '"+ Tdurasi +"', '"+ Tframe +"', '"+ Tlokasi +"')";

Konfigurasi.Koneksi();

(8)

Form Player.cs

using System;

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

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

using System.Threading.Tasks; using System.Windows.Forms; using System.Data.OleDb;

namespace SURF_Algorithm {

public partial class Form_Player : Form {

public string video;

public Form_Player() {

InitializeComponent();

this.Closing += (this.Keluar); }

void Keluar(object sender, CancelEventArgs e) {

WMP.Dispose(); }

private void Form_Player_Load(object sender, EventArgs e) {

Konfigurasi.Koneksi();

Konfigurasi.CMD = new OleDbCommand("SELECT Lokasi FROM `Tabel Video` WHERE Nama like '%" + video + "%'", Konfigurasi.CONN);

Konfigurasi.DR = Konfigurasi.CMD.ExecuteReader(); Konfigurasi.DR.Read();

WMP.URL = Konfigurasi.DR.GetString(0); this.Text += " - " + video;

} }}

Form SURF.cs

using System;

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

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

using System.Threading.Tasks; using System.Windows.Forms; using Emgu.CV;

(9)

namespace SURF_Algorithm {

public partial class Form_SURF : Form {

public Form_SURF() {

InitializeComponent();

this.Closing += (this.Keluar); }

void Keluar(object sender, CancelEventArgs e) {

Form_Home FH = new Form_Home(); FH.Show();

}

private void Form_SURF_Load(object sender, EventArgs e) {

Reset(); }

private void btn_pil_gambar_Click(object sender, EventArgs e) {

ofd.Filter = "Image Files |*.gif;*.jpg;*.jpeg;*.bmp;*.wmf;*.png"; ofd.FileName = "";

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

pb_gbr1.Image = Image.FromFile(ofd.FileName); txt_pil_gambar.Text = ofd.FileName;

} }

private void btn_reset_Click(object sender, EventArgs e) {

Reset(); }

private void Reset() {

btn_pil_gambar.Focus(); txt_log.Text = "--> "; txt_pil_gambar.Clear(); lbl_wp.Text = "- Detik"; lbl_th.Text = "0 Video";

pb_gbr1.Image = Properties.Resources.Temp; pb_gbr2.Image = Properties.Resources.Temp; pb_gbr_hasil.Image = Properties.Resources.Temp; lb_video.Items.Clear();

}

private void bw_DoWork(object sender, DoWorkEventArgs e) {

this.Cursor = Cursors.WaitCursor; long matchTime;

double Waktu_Proses = 0.0;

(10)

string[] Folders = Directory.GetDirectories(Application.StartupPath

private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)

{

this.Cursor = Cursors.Default;

MessageBox.Show("Proses Selesai", "Pesan", MessageBoxButtons.OK, MessageBoxIcon.Information);

btn_cari.Enabled = true; btn_reset.Enabled = true; btn_pil_gambar.Enabled = true; }

(11)

groupBox4.BringToFront(); } else

{

groupBox4.Left = 507; groupBox4.Top = 77;

groupBox4.Width = 165; groupBox4.Height = 165; }

}

private void btn_cari_Click(object sender, EventArgs e) {

if (txt_pil_gambar.Text == "") {

MessageBox.Show("Pilih Gambar Terlebih Dahulu", "Pesan", MessageBoxButtons.OK, MessageBoxIcon.Information);

return; }

lbl_wp.Text = "- Detik"; lbl_th.Text = "0 Video"; lb_video.Items.Clear();

bw.RunWorkerAsync();

Control.CheckForIllegalCrossThreadCalls = false;

btn_cari.Enabled = false; btn_reset.Enabled = false; btn_pil_gambar.Enabled = false; }

private void lb_video_SelectedIndexChanged(object sender, EventArgs e) {

try {

Form_Player FP = new Form_Player();

FP.video = lb_video.SelectedItem.ToString(); FP.ShowDialog();

} catch {} } }}

SURF.CS

using System;

using System.Collections.Generic; using System.Diagnostics;

using System.Drawing;

(12)

using Emgu.CV.CvEnum;

/// <param name="modelImageFileName">The model image</param> /// <param name="observedImageFileName">The observed image</param> /// <param name="matchTime">The output total time for computing the homography matrix.</param>

/// <returns>The model image and observed image, the matched features and homography projection.</returns>

public static Image<Bgr, Byte> Draw(String modelImageFileName, String observedImageFileName, out long matchTime, out bool Cocok)

(13)

using (GpuMat<float> gpuObservedKeyPoints = gpuModelDescriptors, gpuMatchIndices, gpuMatchDist, k, null, stream); indices = new Matrix<int>(gpuMatchIndices.Size); while we are waiting for the stream to complete.

(14)

watch = Stopwatch.StartNew();

// extract features from the observed image

observedKeyPoints = surfCPU.DetectKeyPointsRaw(observedImage, null);

Matrix<float> observedDescriptors =

surfCPU.ComputeDescriptorsRaw(observedImage, null, observedKeyPoints); BruteForceMatcher<float> matcher = new

BruteForceMatcher<float>(DistanceType.L2); matcher.Add(modelDescriptors);

indices = new Matrix<int>(observedDescriptors.Rows, k); using (Matrix<float> dist = new

Matrix<float>(observedDescriptors.Rows, k)) {

matcher.KnnMatch(observedDescriptors, indices, dist, k, null);

mask = new Matrix<byte>(dist.Rows, 1); mask.SetValue(255);

Features2DToolbox.VoteForUniqueness(dist, uniquenessThreshold, mask);

}

int nonZeroCount = CvInvoke.cvCountNonZero(mask); if (nonZeroCount >= 4)

{

nonZeroCount =

Features2DToolbox.VoteForSizeAndOrientation(modelKeyPoints, observedKeyPoints, indices, mask, 1.5, 20);

if (nonZeroCount >= 4) homography =

Features2DToolbox.GetHomographyMatrixFromMatchedFeatures(modelKeyPoints, observedKeyPoints, indices, mask, 2);

}

watch.Stop(); }

//Draw the matched keypoints

Image<Bgr, Byte> result = Features2DToolbox.DrawMatches(modelImage, modelKeyPoints, observedImage, observedKeyPoints,

indices, new Bgr(255, 255, 255), new Bgr(255, 255, 255), mask, Features2DToolbox.KeypointDrawType.DEFAULT);

#region draw the projected region on the image if (homography != null)

{ //draw a rectangle along the projected model Cocok = true;

Rectangle rect = modelImage.ROI; PointF[] pts = new PointF[] { new PointF(rect.Left, rect.Bottom), new PointF(rect.Right, rect.Bottom), new PointF(rect.Right, rect.Top), new PointF(rect.Left, rect.Top)}; homography.ProjectPoints(pts);

result.DrawPolyline(Array.ConvertAll<PointF, Point>(pts, Point.Round), true, new Bgr(Color.Red), 5);

(15)

Cocok = false; }

#endregion

matchTime = watch.ElapsedMilliseconds;

return result; }

}}

Program.cs

using System;

using System.Collections.Generic; using System.Linq;

using System.Threading.Tasks; using System.Windows.Forms;

namespace SURF_Algorithm {

static class Program {

/// <summary>

/// The main entry point for the application. /// </summary>

[STAThread]

static void Main() {

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form_Home());

} }}

Konfigurasi.cs

using System; using System.Data; using System.Data.OleDb; using System.Windows.Forms;

namespace SURF_Algorithm {

public static class Konfigurasi {

public static OleDbConnection CONN; public static OleDbDataAdapter DA; public static DataSet DS;

(16)

public static OleDbCommand CMD; public static OleDbDataReader DR;

public static void Koneksi() {

try {

const string Q = "provider=microsoft.jet.oledb.4.0; data source = DB.mdb;";

CONN = new OleDbConnection(Q);

if (CONN.State == ConnectionState.Closed) {

CONN.Open(); }

}

catch (Exception e) {

MessageBox.Show(e.ToString(), "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

(17)

D

AFTAR

R

IWAYAT

H

IDUP

CURRICULUM VITAE

I.

DATA PRIBADI /

Personal Identification

Nama Lengkap

:

EviP. Marpaung

Tempat /

Tanggal Lahir

:

Medan /

16 Februari 1995

Jenis Kelamin

:

Perempuan

Agama

:

Kristen Protestan

Kebangsaan

:

Indonesia

Alamat

:

DSN IX Jl. Sejarah No.54 DesaMekar Sari,Delitua, Sumatera Utara,

Indonesia 20035

Telepon

:

+6281260957680

Tinggi / Berat

:

163 cm / 48 kg

Email

:

evimarpaung131401107@gmail.com

II.

KESEHATAN /

Health

(18)

Bahasa Pemrograman

: C#

Database

: MySQL

Lainnya

: Ms. Office

IV.

PENDIDIKAN FORMAL /

Formal Education

[ 2013

2017 ]

“Implementasi Content Based Video Retrieval Menggunakan Speeded

-Up Robust

Features”

S1 Ilmu Komputer, Fakultas Ilmu Komputer dan Teknologi Informasi

Universitas Sumatera Utara

[ 2010

2013 ]

SMA Negeri 2 Medan

[ 2007

2010 ]

SMP Negeri 34 Medan

[ 2001

2007 ]

SD N 060899

[2000

2001 ]

TK ‘Aisyiyah Bustanul Athfal

V.

PENDIDIKAN NON-FORMAL / Informal Education

[ 2012

2013 ]

BT / BS Medica, Medan

[ 2004

2005 ]

Standard English Courses, Medan

VI.

PRESTASI /

Achievements

1)

Sertifikasi Internasional Microsoft Office Powerpoint 2010 , Medan [2016]

VII.

SEMINAR /

Seminars

(19)

VIII.

PENGALAMAN ORGANISASI /

Organizational Experiences

1)

Anggota Unit Kegiatan Mahasiswa Kebaktian Mahasiswa Kristen Universitas Sumatera

Utara [2013

2017]

IX.

PENGALAMAN KEPANITIAAN /

Committee Experiences

1)

Anggota Kesehatan Penerimaan Mahasiswa Baru S1 Ilmu Komputer USU [2015]

2)

Anggota Konsumsi Paskah Oikumene USU [2014]

3)

Panitia Pelaksana Natal Oikumene USU [2014]

4)

Anggota Kesehatan PORSENI IMILKOM USU [2014]

5)

Anggota Dana Paskah Fasilkom-TI USU [2014]

6)

Anggota Humas Natal S1 Ilmu Komputer USU [2013]

X.

PENGALAMAN BEKERJA /

Working Experience

Referensi

Dokumen terkait

2014 melalui SPSE, dengan ini diumumkan bahwa pelaksanaan Pengadaan Kontrasepsi Intra Uterine Device (IUD) Tahap II TA. 2014 telah ditetapkan Pemenang

Untuk selanjutnya keputusan Presiden RI Nomor 172, terhitung tanggal 1 Juni 1957 Kantor Pusat Statistik (KPS) diubah menjadi Biro Pusat Statistik yang semula menjadi

Pola Komunikasi Orang Tua dalam Mengatasi Kesulitan Berkomunikasi Anak Autis (Studi pada Orang Tua Anak Autis di Sekolah Dasar Swasta Khusus Autis Anak Mandiri Jalan Kutilang No.

Penilai kerugian asuransi dalam industri asuransi di Indonesia berdasarkan Undang-Undang Nomor 40 Tahun 2014, yaitu usaha jasa penilaian klaim dan/atau jasa konsultasi atas

Melaksanakan verifikasi dan kajian terhadap permohonan perizinan bidang koperasi, usaha kecil, dan menengah sesuai dengan lingkup tugas seksi berpedoman pada ketentuan

hubungan komunikasi interpersonal orang tua dalam membentuk perkembangan. anak usia sekolah di SD

Sistem tertentu adalah suatu sistem yang operasinya dapat diprediksi secara tepat sedangkan sistem tak tertentu adalah sistem dengan perilaku ke depan yang tidak

Selain itu, yang membedakan sebaran alel gen APOE antara penderita Sindrom Down dengan populasi normal yang dalam hal ini diwakili oleh kontrol adalah pada