• Tidak ada hasil yang ditemukan

Implementasi Deteksi Tepi Canny Dan Isotropik Dengan Transformasi Power Law Studi Kasus Kanker Mulut Rahim (Serviks)

N/A
N/A
Protected

Academic year: 2017

Membagikan "Implementasi Deteksi Tepi Canny Dan Isotropik Dengan Transformasi Power Law Studi Kasus Kanker Mulut Rahim (Serviks)"

Copied!
22
0
0

Teks penuh

(1)

LISTING PROGRAM

1.

Deteksitepi.cs

using System;

using System.Drawing;

using System.Windows.Forms;

using System.Runtime.InteropServices; namespace skripsi

{

public partial class deteksitepi : Form {

Canny CannyData; publicdeteksitepi() {

InitializeComponent(); }

void HomeToolStripMenuItemClick(object sender, EventArgs e) {

MainForm f2 = newMainForm(); f2.Show();

this.Hide(); }

void AboutToolStripMenuItemClick(object sender, EventArgs e) {

about F2 = newabout(); F2.Show();

this.Hide(); }

void DeteksiTepiToolStripMenuItemClick(object sender, EventArgs e) {

deteksitepi F2 = newdeteksitepi(); F2.Show();

this.Hide(); }

(2)

void DeteksiKankerToolStripMenuItemClick(object sender, EventArgs e) {

deteksikanker F2 = newdeteksikanker(); F2.Show();

this.Hide(); }

void Button3Click(object sender, EventArgs e) // membersihkan semua data {

pictureBox1.Image = null; pictureBox2.Image = null; pictureBox3.Image = null; pictureBox4.Image = null; textBox1.Text = null; textBox2.Text = null; textBox3.Text = null; textBox5.Text = null; textBox6.Text = null; textBox4.Text = null; textBox7.Text = null; textBox8.Text = null; textBox9.Text = null; }

void Button1Click(object sender, EventArgs e)// method input citra {

OpenFileDialog open = newOpenFileDialog(); open.Filter = "Image Files(*.png)|*.png"; if (open.ShowDialog() == DialogResult.OK) {

pictureBox2.Image = newBitmap(open.FileName); textBox1.Text = open.FileName;

} }

void Button2Click(object sender, EventArgs e) //private canny {

DateTime dp = DateTime.Now;

CannyData = newCanny((Bitmap)pictureBox4.Image,20,10,5,1 ); pictureBox1.Image = CannyData.DisplayImage(CannyData.EdgeMap); TimeSpan ds = DateTime.Now - dp;

(3)

= HitungMSE((Bitmap)pictureBox4.Image,(Bitmap)pictureBox1.Image).ToString(); textBox7.Text = HitungPSNR(Convert.ToDouble(textBox4.Text)).ToString(); }

private Bitmap Isotropik ( Bitmap Original)// private isotropik {

Bitmap isotropik = newBitmap(Original); int [,] arr_r;

int [,] arr_g; int [,] arr_b;

byte[,] temp_array;

arr_r = newint[isotropik.Width, isotropik.Height]; arr_g = newint[isotropik.Width, isotropik.Height]; arr_b = newint[isotropik.Width, isotropik.Height]; temp_array=newbyte[isotropik.Width, isotropik.Height]; double x;

double y; double grad;

for (int i = 1; i < (isotropik.Width - 1); i++) {

for (int j = 1; j < (isotropik.Height - 1); j++) {

arr_r[i, j] = Original.GetPixel(i, j).R; arr_g[i, j] = Original.GetPixel(i, j).G; arr_b[i, j] = Original.GetPixel(i, j).B;

arr_r[i, j] = (arr_r[i, j] + arr_g[i, j] + arr_b[i, j]) /3; }

}

for (int i = 1; i < (isotropik.Width-1); i++) {

for (int j = 1; j < (isotropik.Height-1); j++) {

x=System.Math.Abs(1*arr_r[i-1,1]+1.41421*arr_r[i-1,j]+1*arr_r[i-1,j+1]-arr_r[i+1, j-1]-1.41421*arr_r[i+1, j] -arr_r[i + 1, j + 1]);

y=System.Math.Abs (1*arr_r[i-1,j-1]+1.41421*arr_r[i,j-1]+1*arr_r[i+1,j-1]-1*arr_r[i-1,j+1]-1.41421*arr_r[i,j+1]-1*arr_r[i+1,j+1]);grad = System.Math.Sqrt(x*x+y*y);

if ( grad > 255) grad =255; temp_array[i, j] =(byte)(grad);

isotropik.SetPixel(i,j,Color.FromArgb(temp_array[i, j],temp_array[i, j],temp_array[i,j])) ;

}

} return isotropik; }

(4)

void Button4Click(object sender, EventArgs e) //menyimpan gambar canny {

SaveFileDialog save = newSaveFileDialog(); save.Filter = "Image Files(*.png) | *.png"; if (save.ShowDialog() == DialogResult.OK) {

textBox2.Text = save.FileName;

pictureBox1.Image.Save(save.FileName, System.Drawing.Imaging.ImageFormat.Png); MessageBox.Show("Apakah anda ingin menyimpan gambar ?", "

Simpan", MessageBoxButtons.OK); }

else {

MessageBox.Show("Gagal Menyimpan gambar !"); }

}

void SaveisoClick(object sender, EventArgs e)// menyimpan gambar isotropik {

SaveFileDialog save = newSaveFileDialog(); save.Filter = "Image Files(*.png) | *.png"; if (save.ShowDialog() == DialogResult.OK) {

textBox3.Text = save.FileName;

pictureBox3.Image.Save(save.FileName, System.Drawing.Imaging.ImageFormat.Png); MessageBox.Show("Apakah anda ingin menyimpan

gambar?", "Simpan", MessageBoxButtons.OK); }

else {

MessageBox.Show("Gagal Menyimpan Gambar !"); }

}

void Button5Click(object sender, EventArgs e)// proses isotropik {

DateTime dp = DateTime.Now;

Bitmap bit = newBitmap(pictureBox4.Image); int x = bit.Height; int y = bit.Width;

double rd=0,bl=0,gr=0,gy=0;

Bitmap imageHasil = newBitmap(x,y); for (int i = 0; i < x-1; i++)

(5)

for (int j = 0; j <= y-1; j++) {

if (rd <=0) rd = 255;

gr = bit.GetPixel(i,j).G; bl = bit.GetPixel(i,j).B;

gy = (rd*0.3 + gr*0.59 + bl*0.11);

imageHasil.SetPixel(i,j,Color.FromArgb((int)gy,(int)gy,(int)gy)); gy = 0;

} }

pictureBox3.Image=Isotropik(imageHasil); TimeSpan ds = DateTime.Now - dp; double waktu = ds.TotalMilliseconds; textBox6.Text = (waktu/1000).ToString(); textBox8.Text

= HitungMSE((Bitmap)pictureBox4.Image,(Bitmap)pictureBox3.Image).ToString(); textBox9.Text = HitungPSNR(Convert.ToDouble(textBox8.Text)).ToString(); }

void Button6Click(object sender, EventArgs e)// transformasi {

double c = 50 ; double gamma = 0.2 ;

int x = pictureBox2.Image.Width; int y = pictureBox2.Image.Height;

Bitmap original = (Bitmap)pictureBox2.Image; Bitmap gs = newBitmap(x,y);

for (int i = 0; i < x; i++) {

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

Color ori = original.GetPixel(i,j);

int transfor = (int)(c * Math.Pow(ori.G, gamma));

Color newcolor = Color.FromArgb(transfor,transfor,transfor); gs.SetPixel(i,j,newcolor);

} }

pictureBox4.Image = gs; }

doubleHitungMSE(Bitmap imageAsli, Bitmap imageHasil) {

(6)

double pxAsli; double pxHasil; double MSE;

for (int i = 0; i < imageAsli.Height; i++) {

for (int j = 0; j < imageAsli.Width; j++) {

pxAsli = imageAsli.GetPixel(j, i).R; pxHasil = imageHasil.GetPixel(j, i).R; sum += Math.Pow(pxAsli - pxHasil, 2); }

}

MSE = sum / (imageAsli.Height * imageAsli.Width); return MSE;

}

doubleHitungPSNR (double MSE) {

double PSNR = Math.Log10(Math.Pow(255, 2)/MSE); return PSNR;

} } }

2.

Deteksikanker.cs

using System;

using System.Drawing;

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

using System.Linq; namespace skripsi {

public partial class deteksikanker : Form {

int hasil;

publicdouble[] gambaruji,d; publicdouble[,] gambaracuan; publicint linecount;

publicdeteksikanker() {

InitializeComponent(); }

(7)

{

OpenFileDialog open = newOpenFileDialog(); open.Filter = "Image Files(*.png)|*.png"; if (open.ShowDialog() == DialogResult.OK) {

pictureBox1.Image = newBitmap(open.FileName); textBox1.Text = open.FileName;

} }

void Button4Click(object sender, EventArgs e)//input gambar isotropik {

OpenFileDialog open = newOpenFileDialog(); open.Filter = "Image Files(*.png)|*.png"; if (open.ShowDialog() == DialogResult.OK) {

pictureBox2.Image = newBitmap(open.FileName); textBox2.Text = open.FileName;

} }

void Button2Click(object sender, EventArgs e) // proses ED canny {

label2.Text = "";

Bitmap gu = (Bitmap)pictureBox1.Image; gambaruji = newdouble[40000]; int k =0;

for (int i = 0; i < 200; i++) {

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

gambaruji[k] = gu.GetPixel(i, j).R; k++;

} }

string alamat = "D:\\Semester VII\\skripsi\\Skripsi\\program\\fix\\skripsi\\hasil detek\\canny\\data.txt";

string[] lines = File.ReadAllLines(alamat); int linecount = lines.Length;

Bitmap gc;

gambaracuan = newdouble[linecount,40000]; for (int i = 0; i < linecount; i++)

(8)

gc = (Bitmap) Image.FromFile(@"D:\Semester

VII\skripsi\Skripsi\program\fix\skripsi\hasil detek\canny\" + lines[i] + ".png"); for (int ii = 0; ii < 200; ii++)

{

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

gambaracuan[i,k] = gc.GetPixel(ii, j).R; k++;

} } }

euclidean eul = neweuclidean(); d = eul.run(gambaruji, gambaracuan); double mind = d.Min();

for (int i = 0; i < d.Length; i++) {

if (mind == d[i]) {

hasil = i; break; }

}

label1.Text = lines[hasil].Substring(0,9); if(label1.Text == "Stadium 1")

{

label2.Text = "1. Operasi\n2. Radioterapi"; }

elseif(label1.Text == "Stadium 2") {

label2.Text = "1. Operasi\n2. Gabungan Kemoterapi dan Radioterapi (Chemoradiotherapy)";

}

elseif(label1.Text == "Stadium 3") {

label2.Text = "1. Kombinasi Kemoterapi dan Radioterapi (Chemoradiotherapy)"; }

elseif(label1.Text == "Stadium 4") {

label2.Text = "1. Kombinasi Operasi Radikal, Kemoterapi, dan Radioterapi (Chemoradiotherapy)";

} }

(9)

{

label5.Text = "";

Bitmap gu = (Bitmap)pictureBox2.Image; gambaruji = newdouble[40000];

int k =0;

for (int i = 0; i < 200; i++) {

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

gambaruji[k] = gu.GetPixel(i, j).R; k++;

} }

string alamat = "D:\\Semester VII\\skripsi\\Skripsi\\program\\fix\\skripsi\\hasil detek\\isotropik\\data.txt";

string[] lines = File.ReadAllLines(alamat); int linecount = lines.Length;

Bitmap gc;

gambaracuan = newdouble[linecount,40000]; for (int i = 0; i < linecount; i++)

{ k = 0;

gc = (Bitmap) Image.FromFile(@"D:\Semester

VII\skripsi\Skripsi\program\fix\skripsi\hasil detek\isotropik\" + lines[i] + ".png"); for (int ii = 0; ii < 200; ii++)

{

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

gambaracuan[i,k] = gc.GetPixel(ii, j).R; k++;

} } }

euclidean eul = neweuclidean(); d = eul.run(gambaruji, gambaracuan); double mind = d.Min();

for (int i = 0; i < d.Length; i++) {

if (mind == d[i]) {

hasil = i; break; }

(10)

label6.Text = lines[hasil].Substring(0,9); if(label6.Text == "Stadium 1")

{

label5.Text = "1. Operasi\n2. Radioterapi"; }

elseif(label6.Text == "Stadium 2") {

label5.Text = "1. Operasi\n2. Gabungan Kemoterapi dan Radioterapi (Chemoradiotherapy)";

}

elseif(label6.Text == "Stadium 3") {

label5.Text = "1. Kombinasi Kemoterapi dan Radioterapi (Chemoradiotherapy)"; }

elseif(label6.Text == "Stadium 4") {

label5.Text = "1. Kombinasi Operasi Radikal, Kemoterapi, dan Radioterapi (Chemoradiotherapy)";

} } } }

3.

Canny.cs using System;

using System.Collections.Generic; using System.Text;

using System.Drawing.Imaging; using System.Windows.Forms; using System.Drawing;

using System.IO; namespace skripsi {

class Canny {

publicint Width, Height; public Bitmap Obj; publicint[,] GreyImage; //Gaussian Kernel Data int [,] GaussianKernel; int KernelWeight ; int KernelSize =5;

(11)

2 2*Sigma = (int)N/2

//Canny Edge Detection Parameters

float MaxHysteresisThresh, MinHysteresisThresh; publicfloat[,] DerivativeX;

publicfloat[,] DerivativeY; publicint[,] FilteredImage; publicfloat[,] Gradient; publicfloat[,] NonMax; publicint[,] PostHysteresis; int[,] EdgePoints;

publicfloat[,] GNH; publicfloat[,] GNL; publicint[,] EdgeMap; publicint[,] VisitedMap; publicCanny(Bitmap

Input, float Th, float Tl, int GaussianMaskSize, float SigmaforGaussianKernel) {

// Gaussian and Canny Parameters

MaxHysteresisThresh = Th; MinHysteresisThresh = Tl; KernelSize = GaussianMaskSize; Sigma = SigmaforGaussianKernel; Obj = Input;

Width = Obj.Width; Height = Obj.Height;

EdgeMap = newint[Width, Height]; VisitedMap = newint[Width, Height]; ReadImage();

DetectCannyEdges(); return;

}

public Bitmap DisplayImage(int[,] GreyImage) {

int i, j; int W, H;

W = GreyImage.GetLength(0); H = GreyImage.GetLength(1); Bitmap image = newBitmap(W, H);

(12)

unsafe {

byte* imagePointer1 = (byte*)bitmapData1.Scan0; for (i = 0; i < bitmapData1.Height; i++)

{

for (j = 0; j < bitmapData1.Width; j++) {

// write the logic implementation here imagePointer1[0] = (byte)GreyImage[j, i]; imagePointer1[1] = (byte)GreyImage[j, i]; imagePointer1[2] = (byte)GreyImage[j, i]; imagePointer1[3] = (byte)255;

//4 bytes per pixel imagePointer1 += 4; } //end for j

//4 bytes per pixel

imagePointer1 += (bitmapData1.Stride - (bitmapData1.Width * 4)); }//End for i

}//end unsafe

image.UnlockBits(bitmapData1); return image;// col;

} // Display Grey Image

private void ReadImage() {

int i, j;

GreyImage = newint[Obj.Width, Obj.Height]; //[Row,Column] Bitmap image = Obj;

BitmapData bitmapData1 =

image.LockBits(newRectangle(0, 0, image.Width, image.Height),

ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); unsafe

{

byte* imagePointer1 = (byte*)bitmapData1.Scan0; for (i = 0; i < bitmapData1.Height; i++)

{

for (j = 0; j < bitmapData1.Width; j++) {

GreyImage[j, i] = (int)((imagePointer1[0] + imagePointer1[1] + imagePoi nter1[2]) / 3.0);

(13)

imagePointer1 += 4; }//end for j

//4 bytes per pixel

imagePointer1 += bitmapData1.Stride - (bitmapData1.Width * 4); }//end for i

}//end unsafe

image.UnlockBits(bitmapData1); return;

}

private void GenerateGaussianKernel(int N, float S ,outint Weight) {

float Sigma = S ; float pi;

pi = (float)Math.PI; int i, j;

int SizeofKernel=N;

float [,] Kernel = newfloat [N,N]; GaussianKernel = newint [N,N]; float[,] OP = newfloat[N, N]; float D1,D2;

D1= 1/(2*pi*Sigma*Sigma); D2= 2*Sigma*Sigma;

float min=1000;

for (i = -SizeofKernel / 2; i <= SizeofKernel / 2; i++) {

for (j = -SizeofKernel / 2; j <= SizeofKernel / 2; j++) {

Kernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] = ((1 / D1) * (float)Math.Ex p(-(i * i + j * j) / D2));

if (Kernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] < min) min = Kernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j]; }

}

int mult = (int)(1 / min); int sum = 0;

if ((min > 0) && (min < 1)) {

(14)

{

for (j = -SizeofKernel / 2; j <= SizeofKernel / 2; j++) {

Kernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] = (float)Math.Round(Ker nel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] * mult, 0);

GaussianKernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] = (int)Kernel[Siz eofKernel / 2 + i, SizeofKernel / 2 + j];

sum = sum + GaussianKernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j]; }

} } else {

sum = 0;

for (i = -SizeofKernel / 2; i <= SizeofKernel / 2; i++) {

for (j = -SizeofKernel / 2; j <= SizeofKernel / 2; j++) {

Kernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] = (float)Math.Round(Ker nel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] , 0);

GaussianKernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j] = (int)Kernel[Siz eofKernel / 2 + i, SizeofKernel / 2 + j];

sum = sum + GaussianKernel[SizeofKernel / 2 + i, SizeofKernel / 2 + j]; }

} }

//Normalizing kernel Weight Weight= sum;

return; }

privateint[,] GaussianFilter(int[,] Data) {

GenerateGaussianKernel(KernelSize, Sigma,out KernelWeight); int[,] Output = newint[Width, Height];

int i, j,k,l;

int Limit = KernelSize /2; float Sum=0;

Output = Data; // Removes Unwanted Data Omission due to kernel bias while convolution

for (i = Limit; i <= ((Width - 1) - Limit); i++) {

(15)

{

Sum = 0;

for (k = -Limit; k <= Limit; k++) {

for (l = -Limit; l <= Limit; l++) {

Sum =

Sum + ((float)Data[i + k, j + l] * GaussianKernel [Limit + k, Limit + l]); }

}

Output[i, j] = (int)(Math.Round(Sum/ (float)KernelWeight)); }

}

return Output; }

privatefloat[,] Differentiate(int[,] Data, int[,] Filter) {

int i, j,k,l, Fh, Fw;

Fw = Filter.GetLength(0); Fh = Filter.GetLength(1); float sum = 0;

float[,] Output = newfloat[Width, Height]; for (i = Fw / 2; i <= (Width - Fw / 2) - 1; i++) {

for (j = Fh / 2; j <= (Height - Fh / 2) - 1; j++) {

sum=0;

for(k=-Fw/2; k<=Fw/2; k++) {

for(l=-Fh/2; l<=Fh/2; l++) {

sum=sum + Data[i+k,j+l]*Filter[Fw/2+k,Fh/2+l]; }

}

Output[i,j]=sum;

} }

(16)

private void DetectCannyEdges() {

Gradient = newfloat[Width, Height]; NonMax = newfloat[Width, Height]; PostHysteresis = newint[Width, Height]; DerivativeX = newfloat[Width, Height]; DerivativeY = newfloat[Width, Height];

//Gaussian Filter Input Image

FilteredImage = GaussianFilter(GreyImage); //prewit Masks

int[,] Dx = {{1,0,-1}, {1,0,-1}, {1,0,-1}};

int[,] Dy = {{1,1,1}, {0,0,0}, {-1,-1,-1}};

DerivativeX = Differentiate(FilteredImage, Dx); DerivativeY = Differentiate(FilteredImage, Dy); int i, j;

//Compute the gradient magnitude based on derivatives in x and y: for (i = 0; i <= (Width - 1); i++)

{

for (j = 0; j <= (Height - 1); j++) {

Gradient[i, j] = (float)Math.Sqrt((DerivativeX[i, j] * DerivativeX[i, j]) + (Deri vativeY[i, j] * DerivativeY[i, j]));

}

}

// Perform Non maximum suppression: // NonMax = Gradient;

for (i = 0; i <= (Width - 1); i++) {

(17)

NonMax[i, j] = Gradient[i, j]; }

}

int Limit = KernelSize / 2; int r, c;

float Tangent;

for (i = Limit; i <= (Width - Limit) - 1; i++) {

for (j = Limit; j <= (Height - Limit) - 1; j++) {

if (DerivativeX[i, j] == 0) Tangent = 90F; else

Tangent

= (float)(Math.Atan(DerivativeY[i, j] / DerivativeX[i, j]) * 180 / Math.PI); //rad to degree

//Horizontal Edge if

(((-22.5 < Tangent) && (Tangent <= (((-22.5)) || ((67.5 < Tangent) && (Tangent <= -677.5))) {

if ((Gradient[i, j] < Gradient[i, j + 1]) || (Gradient[i, j] < Gradient[i, j - 1])) NonMax[i, j] = 0;

}

//Vertical Edge

if (((112.5 < Tangent) && (Tangent <= -67.5)) || ((67.5 < Tangent) && (Tangent <= 112.5))) {

if ((Gradient[i, j] < Gradient[i + 1, j]) || (Gradient[i, j] < Gradient[i - 1, j])) NonMax[i, j] = 0;

}

//grad edge

if (((157.5 < Tangent) && (Tangent <= -112.5)) || ((112.5 < Tangent) && (Tangent <= 157.5))) {

if ((Gradient[i, j] < Gradient[i + 1, j]) || (Gradient[i, j] < Gradient[i - 1, j])) NonMax[i, j] = 0;

}

(18)

if (((67.5 < Tangent) && (Tangent <= -22.5)) || ((112.5 < Tangent) && (Tangent <= 157.5))) {

if ((Gradient[i, j] < Gradient[i + 1, j 1]) || (Gradient[i, j] < Gradient[i 1, j + 1]))

NonMax[i, j] = 0; }

//-45 Degree Edge

if (((157.5 < Tangent) && (Tangent <= -112.5)) || ((67.5 < Tangent) && (Tangent <= 22.5))) {

if ((Gradient[i, j] < Gradient[i + 1, j + 1]) || (Gradient[i, j] < Gradient[i 1, j - 1]))

NonMax[i, j] = 0; }

//+135 Degree Edge

if (((22.5 < Tangent) && (Tangent <= -67.5)) || ((157.5 < Tangent) && (Tangent <= 112.5))) {

if ((Gradient[i, j] < Gradient[i + 1, j 1]) || (Gradient[i, j] < Gradient[i 1, j + 1]))

NonMax[i, j] = 0; }

//-135 Degree Edge

if (((112.5 < Tangent) && (Tangent <= -157.5)) || ((22.5 < Tangent) && (Tangent <= 67.5))) {

if ((Gradient[i, j] < Gradient[i + 1, j + 1]) || (Gradient[i, j] < Gradient[i 1, j - 1]))

NonMax[i, j] = 0; }

} }

//PostHysteresis = NonMax;

for (r = Limit; r <= (Width - Limit) - 1; r++) {

for (c = Limit; c <= (Height - Limit) - 1; c++) {

(19)

} }

//Find Max and Min in Post Hysterisis float min, max;

min = 100; max = 0;

for (r = Limit; r <= (Width - Limit) - 1; r++) for (c = Limit; c <= (Height - Limit) - 1; c++) {

if (PostHysteresis[r, c] > max) {

max = PostHysteresis[r, c]; }

if ((PostHysteresis[r, c] < min)&&(PostHysteresis[r, c] >0)) {

min = PostHysteresis[r, c]; }

}

GNH = newfloat[Width, Height]; GNL = newfloat[Width, Height]; ; EdgePoints = newint[Width, Height]; for (r = Limit; r <= (Width - Limit) - 1; r++) {

for (c = Limit; c <= (Height - Limit) - 1; c++) {

if (PostHysteresis[r, c] >= MaxHysteresisThresh) {

EdgePoints[r, c] = 1; GNH[r, c] = 255; }

if ((PostHysteresis[r, c] < MaxHysteresisThresh) && (PostHysteresis[r, c] > = MinHysteresisThresh))

{

EdgePoints[r, c] = 2; GNL[r, c] = 255; }

} }

(20)

for (i = 0; i <= (Width - 1); i++) for (j = 0; j <= (Height - 1); j++) {

EdgeMap[i, j] = EdgeMap[i, j]*255; }

return; }

private void Hysterisis(int[,] Edges) {

int i, j;

int Limit= KernelSize/2;

for (i = Limit; i <= (Width - 1) - Limit; i++) for (j = Limit; j <= (Height - 1) - Limit; j++) {

if (Edges[i, j] == 1) {

EdgeMap[i, j] = 1; }

}

for (i = Limit; i <= (Width - 1) - Limit; i++) {

for (j = Limit; j <= (Height - 1) - Limit; j++) {

if (Edges[i, j] == 1) {

EdgeMap[i, j] = 1; //VisitedMap[i, j] = 1; }

} } return; }

//Canny Class Ends }

}

4.

Euclidean.cs using System;

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

(21)

public class euclidean {

double numXk = 40000;

publicdouble[] run(double[] gambaruji, double[,] gambaracuan) {

double[] abss = newdouble[gambaracuan.GetLength(0)]; for (int j= 0 ; j<abss.Length; j++)

{

abss[j] = 0; }

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

for (int k= 0 ; k<abss.Length; k++) {

abss[k] = abss[k] + (Math.Pow(Math.Abs((gambaruji[j] gambaracuan[k,j])),2));

} }

for (int k= 0 ; k<abss.Length; k++) {

abss[k] = Math.Sqrt(abss[k]); }

return abss; }

(22)

Curriculum Vitae

Nama

: Ika Ayu Lestari

Tempat/Tanggal Lahir

: Padang Halaban / 20 Mei 1995

Jenis Kelamin

: Perempuan

Alamat Sekarang

: Jl. Perjuangan Gang Family Setiabudi Medan

Alamat Orang Tua

: Desa Perk. Padang Halaban LABURA

HP

: 081268414600

E-mail

2013 – 2017

S-1 Ilmu Komputer Sumatera Utara, Medan

Riwayat Pendidikan

2010 – 2013

SMA N 1 Aek Kuo

2007 – 2010

SMP N 1 Aek Kuo

Referensi

Dokumen terkait

bahwa untuk memberikan pedoman dalam pemeriksaan dan serah terima hasil pekerjaan pengadaan barang/jasa sebagaimana dimaksud pada huruf a, perlu disusun Pedoman

Pada kuadran ini menunjukkan faktor-faktor atau atribut yang mempengaruhi kepuasan konsumen yang berada dalam kuadran ini pihak ACR Rent car hanya berkonsentrasi

Menolak secara lugas ajakan baik kerja untuk melakukan transaksi usaha dan atau membantu usaha mereka yang tidak sesuai dengan Tata Nilai PT.. Yodya Karya (Persero)

[r]

Hasil: Prosedur restrain yang diakukan di UPIP sebagian besar kurang sesuai dengan SOP yang telah ditetapkan oleh rumah sakit, diikat dalam waktu lebih dari 4 jam, Pelaksanaan

1) Belum adanya kepastian sebagian garis batas laut dengan negara tetangga. 2) Untuk pulau-pulau yang berpenduduk, kondisi masyarakat di wilayah terse but masih terisolir dan

Kelas Borjuis : kelompok yang memiliki sarana dan alat produksi yaitu perusahaan sebagai modal dalam usaha.. Kelas Proletar : kelompok yang tidak memiliki suasana dan

Sub tema Hambatan tercapainya ASI eksklusif karena Pengaruh Lingkungan (Keluarga) Tema: Pengaruh Lingkungan (Keluarga) Kategori: Mengetahui Hambatan tercapainya ASI