• Tidak ada hasil yang ditemukan

BAB V PENUTUP

B. Saran

Berdasarkan perancangan dan pengujian tugas akhir ini, masih terdapat sangat banyak kekurangan yang membutuhkan banyak pengembangan baik dari

segi penggunaan dan system kerja. Demi kemajuan dan pengembangan alat ini, maka penulis mempunyai beberapa saran sebagai berikut:

1. Pembacaan sensor sebagai pendeteksi suhu dapat ditingkatkan dengan mengganti sensor MLX90614 dengan sensor suhu non-contact jenis lain yang mempunyai jarak ukur diatas 5 cm

2. Untuk kedepannya diharapkan alat ini dapat dikembangkan lagi dengan menambahkan keluaran tidak hanya melalui LCD saja tetapi dapat ditambahkan output suara.

DAFTAR PUSTAKA

Kadir Abdul (2013). Panduan Praktis Mempelajari Aplikasi Mikrokontroler dan Pemrogramannya Menggunakan Arduino. CV. Andi Offset.

Fezari, M., Dahoud, A.A. (2018). Integrated Development Environment “IDE” For Arduino. Al-Zaytoonah University 12.

Junaidi, Yuliyan Dwi Prabowo (2018). Project Sistem Kendali Elektronik Berbasis Arduino. AURA - Anugrah Utama Raharja.

Lardinois, F. (2015). Microsoft Launches Visual Studio Code, a Free Cross- Platform Code Editor for OS X, Linux and Windows. Tech Crunch. URL https://techcrunch.com/2015/04/29/microsoft-shocks-the-world-with visual-studio-code-a-free-code-editor-for-os-x-linux-and-windows/ (accessed 15 November 2020).

Malexis Microelectronic (2006). MLX90614 Data Sheet.

Nurdin, A.F. (2016). Analisis dan Perancangan Simulasi Sistem Peringatan Dini Air Bah pada Air Terjun. Repositori UIN Alauddin Makasar.

OpenCV Team (2020). OpenCV. URL https://opencv.org/about/ (accessed 25 November 2020).

Oracle Corporation (2020). MySQL 8.0 Reference Manual. MySQL. URL

https://dev.mysql.com/doc/refman/8.0/en/what-is mysql.html (accessed 16

Pambudi, W.S., Tompunu, A.N., Kusumanto, R. (2012). Aplikasi Sensor Vision untuk Deteksi MultiFace dan Menghitung Jumlah Orang. Seminar Nasional Teknologi Informasi & Komunikasi Terapan 2012

Rizal, M., Djuriatno, W., Rif’an, M. (2013). Implementasi Kamera webcam OV7670 Sebagai Pendeteksi Garis Pada Robot Line Follower. Jurnal Mahasiswa TEUB 1, 6.

Safitri, M., Dinata, G.A. (2019). Non-Contact Thermometer Berbasis Infra Merah. Simet 10, 21–26. https://doi.org/10.24176/simet.v10i1.2647

Sheikhi, K., Shirzadfar, H., Sheikhi, M. (2020). A Review on Novel Coronavirus (Covid-19): Symptoms, Transmission and Diagnosis Tests. Research in Infectious Diseases and Tropical Medicine 9.

(Sensor MLX90614, LCDI2C, BUZZER)

/*************************************************** This is a library example for the MLX90614 Temp Sensor

Designed specifically to work with the MLX90614 sensors in the adafruit shop

----> https://www.adafruit.com/products/1747 3V version ----> https://www.adafruit.com/products/1748 5V version

These sensors use I2C to communicate, 2 pins are required to interface

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing

products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.

BSD license, all text above must be included in any redistribution ****************************************************/ //Library #include <Adafruit_MLX90614.h> #include <SoftwareSerial.h> #include <Wire.h> #include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display //inisialisasi atau pembuatan variabel

LiquidCrystal_I2C lcd(0x27, 16, 2); float a; float normal; float corona; int buzzer = 7; Adafruit_MLX90614 mlx = Adafruit_MLX90614(); //setting/setup void setup() {

pinMode(buzzer, OUTPUT);

Serial.begin(9600); lcd.begin(); lcd.setCursor(0,0); lcd.print("Temperature "); mlx.begin(); }

//Loop berfungsi sebagai instruksi berulang sebuah pekerjaan

void loop() {

a=mlx.readObjectTempC(); a=a+2;

//Rumus Pengaturan sensor dan langkah langkah kerja aplikasi

if (a>=37.1) { corona=a; lcd.backlight();

Serial.print(corona);

delay(2400);

digitalWrite(buzzer,LOW) ;

} else if (a>=35.2) { normal=a;

Serial.print(normal);

lcd.backlight(); lcd.setCursor(4,1); lcd.print(normal);

digitalWrite(buzzer,HIGH);

delay(200);

digitalWrite(buzzer,LOW);

delay(1100); } else { normal=a lcd.backlight(); lcd.setCursor(4,1);

Serial.print(normal);

lcd.print(normal);

digitalWrite(buzzer,LOW);

delay(500); } Serial.println(); delay(500); }

PROGRAM VISUAL STUDIO 2019 (Face Detection) using Emgu.CV; using Emgu.CV.Structure; usingEmgu.CV.Util; using Emgu.CV.CvEnum; 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; usingSystem.Drawing.Drawing2D; using System.Collections; usingSystem.IO; using System.Drawing.Imaging; usingSystem.Globalization;

{

public partial class FaceDetection : Form {

//Global Variables

SerialPort port;

string konekstring = "Server=localhost;Database=datapengunjung;Uid=root;Pwd=;";

public void SafeAction(Action action, bool message = true) {

try

{

action(); }

catch (Exception ex) {

if (message) {

MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK,

MessageBoxIcon.Error); }

} }

/// <summary>

/// Start serial communication with Arduino board.

/// </summary>

/// <param name="listeningPort">Listening Port</param> /// <param name="baudRate">Baud Rate</param>

public void InitializeArduino(String listeningPort, int baudRate) {

SafeAction(() => {

port = new SerialPort(listeningPort, baudRate); port.Parity = Parity.None;

port.StopBits = StopBits.One; port.DataBits = 8;

port.Handshake = Handshake.None;

port.DataReceived += newSerialDataReceivedEventHandler(DataReceivedHandler); port.Open();

} ); }

/// <summary>

/// Called when there is new data coming in.

/// </summary>

private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) {

SerialPort sp = (SerialPort)sender; string line = sp.ReadLine();

this.BeginInvoke(newLineReceivedEvent(LineReceived), line); }

label4.Text = line; }

public static int noscala

private Capture capturedCaptureFromWebcam; //a capture from the webcam

private bool isCaptureInProgress; // if capture is in being captured?

private HaarCascade faceHaar; // the data for the face features private HaarCascade eyeHaar;// the data for the eyes features private HaarCascade mouthHaar;// the data for the mouth features

private bool cbFace;

privateBitmap originalImageFromPics; // the original image loaded bu user

privateBitmap temporaryImageCopiedFromOriginal; // an image for temporary usages private Bitmap finalImage;// the image for showing after some detection

private bool imageFit = false;

// global fonts

MCvFont faceFont = newMCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_SIMPLEX, 1, 2); // fonts for the dispaly

MCvFont eyeFont = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_SIMPLEX, 1, 1.0);// fonts for display

MCvFont mouthFont = new

MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_SIMPLEX, 2.0, 2.0);// fonts for display public FaceDetection()

{

InitializeComponent(); // this method initialize the form components //cbFace = cbDetectFaceFile.Checked.ToString();

}

int incNumber = 0;

int nono = 0;

int nonono = 0;

private void openButton_Click(object sender, EventArgs e) {

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

try

{

originalImageFromPics = new Bitmap(openFileDialog.FileName);

// Convert pixel format

originalImageFromPics = originalImageFromPics.Clone(new Rectangle(0, 0, originalImageFromPics.Width, originalImageFromPics.Height), PixelFormat.Format32bppArgb);

temporaryImageCopiedFromOriginal = new Bitmap(originalImageFromPics); pictureBox.Image = originalImageFromPics;

pictureBox.Size = originalImageFromPics.Size; // Resize window

int newWidth = Math.Max(this.PreferredSize.Width, 305); int newHeight = this.PreferredSize.Height;

newWidth = Math.Min(newWidth, Screen.PrimaryScreen.Bounds.Width * 2 / 3); newHeight = Math.Min(newHeight, Screen.PrimaryScreen.Bounds.Height * 2 / 3); this.Size = new Size(newWidth, newHeight);

imageFit = false; }

catch {

MessageBox.Show("Cannot open the file."); }

temporaryImageCopiedFromOriginal = ScaleImage(originalImageFromPics, this.ClientRectangle.Width - pictureBox.Left - 3, this.ClientRectangle.Height - pictureBox.Top - 3); pictureBox.Image = temporaryImageCopiedFromOriginal;

pictureBox.Size = temporaryImageCopiedFromOriginal.Size; imageFit = true;

this.Size = this.PreferredSize; }

public void DetectOrgansInFace(object sender, EventArgs arg) {

#region /*

* This function capture frams from the webcam and detects organs in it * the organs that is being detected are: Face, Eye, And mouth

* */

Image<Bgr, Byte> imageFrameCapturedFromCamera = capturedCaptureFromWebcam.QueryFrame(); // an image will be captured from the camera and will be processed

if(imageFrameCapturedFromCamera!=null) {

Image<Gray, byte> grayOfImageFrameCapturedFromCamera = imageFrameCapturedFromCamera.Convert<Gray, byte>();

// the processing will be done on the GRAY SCALE of the captured images bit the display is yet RGB

if (cbDetectFaceFile.Checked) // checkBox to check if the user wants to detect the Face. {

var faces = grayOfImageFrameCapturedFromCamera.DetectHaarCascade(faceHaar, 1.4, 4, HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,new Size(25, 25))[0];

// an array that holds the faceS detected in the gray scal image //the geometrical features of the face stored in XML format used for detection// a good coeffient to detect the facea good coeffient to detect the face

foreach (var face in faces) {

imageFrameCapturedFromCamera.Draw(face.rect, new Bgr(Color.Blue), 5); // draw a rectangle on the detected face

int faceLableX = face.rect.X; // finding X left-top corner of the face for labeling int faceLableY = face.rect.Y; // finding Y left-top corner of the face for labeling

Point p = new Point(faceLableX, faceLableY); // create a point to attach a lable "FACE" to the point

String s = "Pake Masker";// just a place holder for the "Face" that are goiong to be placed on the top-left corner of the face//

imageFrameCapturedFromCamera.Draw(s, ref faceFont, p, new Bgr(Color.LightYellow)); // Add "Face" lable to the detected fac

//label2.Text = (int.Parse(label2.Text) + 1).ToString(); //timer //if (label2.Text == ("5"))

//{

// label2.

// double value = Convert.ToDouble(label1.Text); //double batassuhu = Convert.ToDouble("36.70"); //if (value >= batassuhu)

//{

//label5.Text = "Corona Terdeteksi";

// webimage.SetResolution(420, 200);

// Facecanvas = Graphics.FromImage(bitmap2);

//Facecanvas.DrawImage(BmpInput, 0, 0, face.rect, GraphicsUnit.Pixel); // string nyNumber = "s" + incNumber.ToString("00");

// string path = @"D:\GambarDeteksi\";

// webimage.Save(path + @"\" + incNumber++ + ".bmp", ImageFormat.Bmp); // pictureBox1.Image = webimage; // } // else // // label5.Text = "Normal"; /// }

var eyes // an araay that holds the detcted eyes and later on we will loop over them

= grayOfImageFrameCapturedFromCamera.DetectHaarCascade(eyeHaar, // the geometrical features of the EYE are stored in the format of XML

4,// after trial and error this coeeffient is ok 3, // after trial and error this coefficient is ok

HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(1, 1))[0];

foreach (var eye in eyes) // more than one eye may be detected so for each eye there will be a rectangle

{

imageFrameCapturedFromCamera.Draw(eye.rect, new Bgr(Color.Red), 2); // for each detecte eye in the image a rectangle will be drawn on the image int eyeLableX = eye.rect.X; // find the X top-left corner of the eye for labeling int eyeLableY = eye.rect.Y; // find the Y top-left corneer of the eye for lableing

Point p = new Point(eyeLableX, eyeLableY); // create a point p to attach the lable "EYE" to it

String e = label1.Text; // just a place holder for the string "EYE"

imageFrameCapturedFromCamera.Draw(e, ref eyeFont, p, new Bgr(Color.Yellow)); // add a string "EYE" to the image captured from webcam just to be distingushable

label2.Text = (int.Parse(label2.Text) + 1).ToString(); //timer if (label2.Text == "8")

{

label2.Text = "0";

double value = Convert.ToDouble(label1.Text); double batassuhu = Convert.ToDouble("36.70"); double batassuhubawa = Convert.ToDouble("33.70"); if (value >= batassuhu)

{

string path1 = @"D:\GambarDeteksi\";

webimage1.Save(path1 + @"\" + incNumber++ + ".bmp", ImageFormat.Bmp); pictureBox1.Image = webimage1;

}

else if (label6.Text == "3") {

Bitmap webimage2 = new Bitmap(webCameraImageBoxRGB.Image.Bitmap); webimage2.SetResolution(420, 200);

string nyNumber2 = "s" + incNumber.ToString("00"); string path2 = @"D:\GambarDeteksi\";

webimage2.Save(path2 + @"\" + incNumber++ + ".bmp", ImageFormat.Bmp); pictureBox2.Image = webimage2;

}

else if (label6.Text == "5") {

Bitmap webimage3 = new Bitmap(webCameraImageBoxRGB.Image.Bitmap); webimage3.SetResolution(420, 200);

string nyNumber3 = "s" + incNumber.ToString("00"); string path3 = @"D:\GambarDeteksi\";

webimage3.Save(path3 + @"\" + incNumber++ + ".bmp", ImageFormat.Bmp); pictureBox3.Image = webimage3; } else if (label6.Text == "6") { label6.Text = "0"; }

label5.Text = "Corona Terdeteksi";

// Bitmap BmpInput = grayOfImageFrameCapturedFromCamera.Bitmap; // Graphics Facecanvas;

//Bitmap bitmap2 = new Bitmap(face.rect.Width, face.rect.Height);

// Bitmap webimage = new Bitmap(webCameraImageBoxRGB.Image.Bitmap); //webimage.SetResolution(420, 200);

//Facecanvas = Graphics.FromImage(bitmap2);

//Facecanvas.DrawImage(BmpInput, 0, 0, face.rect, GraphicsUnit.Pixel); // string nyNumber = "s" + incNumber.ToString("00");

// string path = @"D:\GambarDeteksi\";

// webimage.Save(path + @"\" + incNumber++ + ".bmp", ImageFormat.Bmp); // pictureBox1.Image = webimage;

// pictureBox2.Image = webimage; // pictureBox3.Image = webimage;

///// ini untuk kirim data base

var connection = new MySqlConnection("Server=localhost;Database=datapengunjung;Uid=root;Pwd=;");

connection.Open();

var command = new MySqlCommand("INSERT INTO data(no,tanggal,jam,temperature) values(@no,@tanggal,@jam,@temperature ) ON DUPLICATE KEY UPDATE tanggal = @tanggal, jam = @jam, temperature = @temperature", connection);

MySqlParameter paramName = new MySqlParameter(); paramName.ParameterName = "@no";

MySqlParameter paramEmail = new MySqlParameter(); paramEmail.ParameterName = "@jam";

paramEmail.Value = DateTime.Now.ToString("hh:mm"); MySqlParameter tempe = new MySqlParameter(); tempe.ParameterName = "@temperature"; tempe.Value = label4.Text; command.Parameters.Add(paramName); command.Parameters.Add(paramUsername); command.Parameters.Add(paramEmail); command.Parameters.Add(tempe); int count = command.ExecuteNonQuery(); if (count > 0)

{

Console.WriteLine("{0} row/rows affected", count); loaddata(); label9.Text = (int.Parse(label9.Text) + 1).ToString(); //timer }

connection.Close(); Console.ReadLine();

}

else if (value > batassuhubawa) {

label10.Text = (int.Parse(label10.Text) + 1).ToString(); //timer label5.Text = "Normal"; } else { } } } }

if (cbDetectEyeFile.Checked)// checkBox to check if the user wants to detect the EYEs. {

var eyes // an araay that holds the detcted eyes and later on we will loop over them

foreach (var eye in eyes) // more than one eye may be detected so for each eye there will be a rectangle

{

imageFrameCapturedFromCamera.Draw(eye.rect, new Bgr(Color.Red), 3); // for each detecte eye in the image a rectangle will be drawn on the image int eyeLableX = eye.rect.X; // find the X top-left corner of the eye for labeling int eyeLableY = eye.rect.Y; // find the Y top-left corneer of the eye for lableing

Point p = new Point(eyeLableX, eyeLableY); // create a point p to attach the lable "EYE" to it

String e = "Eye"; // just a place holder for the string "EYE"

imageFrameCapturedFromCamera.Draw(e, ref eyeFont, p, new Bgr(Color.Green)); // add a string "EYE" to the image captured from webcam just to be distingushable

}

}

if (cbDetectMouthFile.Checked)// checkBox to check if the user wants to detect the mouth. {

var mouths // an array to hold the detected MOUTHs

= grayOfImageFrameCapturedFromCamera.DetectHaarCascade

(mouthHaar, // the geometrical features for mouth stored in a XML format 5, // after some trial and error i found this coeffient isbetter

3, // after some trial and error i found this coefficient is better HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(1, 1))[0];

foreach (var mouth in mouths) // loop over all the detected MOUTHs {

imageFrameCapturedFromCamera.Draw(mouth.rect, new Bgr(Color.Black), 3); // draw a recangle for each mouth and put it on the display

int mouthLableX = mouth.rect.X; // find the X top-left corner of the mouth for labling int mouthLableY = mouth.rect.Y; // find the Y top-left corner of the mouth for labling Point p = new Point(mouthLableX, mouthLableY); // create a point to attach the "MOUTH" lable to it

String m = "Mouth"; // just a place holder for string "MOUTH" // add the string mouth to the top-left corner of the detected mouth

imageFrameCapturedFromCamera.Draw(m, ref mouthFont, p, new Bgr(Color.Black)); }

}

// display the image with the detected Face, Eye, Mouth based on user selection

webCameraImageBoxRGB.Image = imageFrameCapturedFromCamera; // processed image will be displayed

}

#endregion }

private void btnStart_Click(object sender, EventArgs e) {

if (string.IsNullOrEmpty(label1.Text)) {

} else { //cbFace = cbDetectFaceFile.Checked; if (capturedCaptureFromWebcam == null) { try

{//try to capture new captures by invocking the new Capture() method capturedCaptureFromWebcam = new Capture();

}

catch (NullReferenceException excpt) {

MessageBox.Show(excpt.Message);

// if the web cam is not ready so it transfered the error msg to the // display for the user.

// to do list for myself: i should add another camera to // capture the EAR form left and right.

} }

if (capturedCaptureFromWebcam != null) {

if (isCaptureInProgress)

{ // start capturing if the camera is not being used by any other application // and change the btnTxt to Start so user can start webcam

btnStart.Text = "Start Webcam"; // Application.Idle -= DetectOrgansInFace; }

else {

// capturing, so by press one more time it will pause/stop so btnStart.Text = "Stop Webcam";

Application.Idle += DetectOrgansInFace; } isCaptureInProgress = !isCaptureInProgress; } } }

private void disposeDataFromTheMemory() {

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

public void loaddata() {

MySqlConnection koneksi = new MySqlConnection(konekstring); koneksi.Open();

try {

MySqlCommand cmd = koneksi.CreateCommand(); cmd.CommandText = "SELECT * FROM data";

catch (Exception) { throw; } finally { if (koneksi.State == ConnectionState.Open) { koneksi.Clone(); } } }

public void CameraCapture_Load(object sender, EventArgs e) {

// TODO: This line of code loads data into the 'datapengunjungDataSet2.data' table. You can move, or remove it, as needed.

loaddata();

// the XML files are loaded so no need for selection at this point // these are the files that storing the featurs for the

// i put them @C:\Dropbox\Dara\CLASS\CS740\HW\HW07\FaceDetection\bin\Debug // but it can be loaed wthile runing the code

faceHaar = new HaarCascade("haarcascade_frontalface_alt_tree.xml"); eyeHaar = new HaarCascade("haarcascade_eye.xml");

mouthHaar = new HaarCascade("haarcascade_Mouth.xml");

}

/*

* this method loops over pixels Row*Column if the pixel is classified as * skin, it will not be any changes to the RGB values

* if it is classifed as notSking it will be recolored as BLACK color pixel. */

public static void DetectSkin(Bitmap originalImagePassed, ref Bitmap modifiedImageWithSkin) {

/* reference of the paper:

* http://www.cs.hmc.edu/~fleck/naked-skin.html *

*

*The RGB values are then transformed into log-opponent values I, Rg, and By *as follows: L(x) = 105*log_10(x+1+n) I = L(G) Rg = L(R) - L(G) By = L(B) - (L(G) + L(R))/2 hue = atan2(Rg,By) * (180 / 3.141592654f) * */ Graphics g = Graphics.FromImage(originalImagePassed);

for (int j = 0; j < originalImagePassed.Height; j++) {

Color colorOfPixel_ij = modifiedImageWithSkin.GetPixel(i, j);

double I = (Math.Log(colorOfPixel_ij.R) + Math.Log(colorOfPixel_ij.G) + Math.Log(colorOfPixel_ij.B)) / 3;

double Rg = Math.Log(colorOfPixel_ij.R) - Math.Log(colorOfPixel_ij.G);

double By = Math.Log(colorOfPixel_ij.B) - (Math.Log(colorOfPixel_ij.G) + Math.Log(colorOfPixel_ij.R)) / 2;

double hue = Math.Atan2(Rg, By) * (180 / Math.PI); // check if it is skin or not

if (I <= 5 && (hue >= 4 && hue <= 255)) {

points.Add(new Point(i, j)); }

else {

// if this pixel is not a skin so paint it as Black modifiedImageWithSkin.SetPixel(i, j, Color.Black); }

} } }

private static void drawLineFromNode1ToNode2(Graphics g, Point p1, Point p2) {

g.DrawLine(Pens.White, p1, p2); }

private static void SortPoints(ref ArrayList arrayOfPoints) {

for (int i = 1; i < arrayOfPoints.Count; i++) {

Point thisPoint = (Point)arrayOfPoints[i]; Point lastPoint = (Point)arrayOfPoints[i - 1];

if (thisPoint.X < lastPoint.X && thisPoint.Y < lastPoint.Y) {

} else

{

swap(ref arrayOfPoints, i - 1, i); }

} }

private static void swap(ref ArrayList arrayOfPoints, int i, int j) {// a normal Swaping func

Point temp;

Point pointI = (Point)arrayOfPoints[i]; Point PointJ = (Point)arrayOfPoints[j]; temp = pointI;

pointI = PointJ; PointJ = temp; }

else if (green > red && green > blue) return green;

else

return blue; }

private static int minOfRGB(int red, int green, int blue) {

if (red < green && red < blue) return red;

else if (green < red && green < blue) return green;

else

return blue; }

private void btnSkinDetection_Click(object sender, EventArgs e) {

//Bitmap original = new Bitmap(@"C:\Dara\Dropbox\CLASS\CS740\HW\HW07\baby.bmp");

Bitmap imageForSkinRecognition = new Bitmap(originalImageFromPics); Bitmap modified = imageForSkinRecognition;

DetectSkin(imageForSkinRecognition, ref modified); //pictureBox.Image = modified;111111111

finalImage = ScaleImage(modified, this.ClientRectangle.Width - pictureBox.Left - 3, this.ClientRectangle.Height - pictureBox.Top - 3);

ImageWindow newWindow = new ImageWindow(finalImage, true); newWindow.Text = "Detected Faces and Skins";

newWindow.Show(); }

public static Bitmap ScaleImage(Image imagePassed, int maxWidth, int maxHeight) {

double ratioX = (double)maxWidth / imagePassed.Width; double ratioY = (double)maxHeight / imagePassed.Height; double ratio = Math.Min(ratioX, ratioY);

int newWidth = (int)(imagePassed.Width * ratio); int newHeight = (int)(imagePassed.Height * ratio);

Bitmap scaledImage = new Bitmap(newWidth, newHeight);

Graphics.FromImage(scaledImage).DrawImage(imagePassed, 0, 0, newWidth, newHeight); return scaledImage;

}

private void panggil() {

}

private void label2_Click(object sender, EventArgs e) {

}

private void button1_Click(object sender, EventArgs e) {

if (string.IsNullOrEmpty(comboBox1.Text)) {

button2.Enabled = false;

MessageBox.Show("Pilih Port Terlebih Dahulu."); } else { if (SerialPort.IsOpen) {

MessageBox.Show("Pilih Port Dan Baud Rate Terlebih Dahulu."); }

else {

SafeAction(() => InitializeArduino(comboBox1.Text, Convert.ToInt32(textBox2.Text))); button2.Enabled = true; button1.Enabled = false; label5.Visible = true; } } }

private void FaceDetection_FormClosing(object sender, FormClosingEventArgs e) {

}

private void button2_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = false; port.Close(); textBox1.Text = null; }

private void textBox1_TextChanged(object sender, EventArgs e) {

textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret();

}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {

}

private void button3_Click(object sender, EventArgs e) {

// Bitmap bitmap = new Bitmap(webCameraImageBoxRGB.Image.Bitmap); // pictureBox1.Image = bitmap;

// string nyNumber = "s" + incNumber.ToString("00"); // string path = @"D:\GambarDeteksi\";

// pictureBox1.Image.Save(path + @"\" + incNumber++ + ".bmp", ImageFormat.Bmp); //double value = Convert.ToDouble(label1.Text);

//double batassuhu = Convert.ToDouble("36.70"); // if (value >= batassuhu)

// {

//label5.Text = "corona terdeteksi"; //}

//else //{

// label5.Text = "Corona terdeteksi"; //}

}

private void timer1_Tick(object sender, EventArgs e) {

label3.Text = DateTime.Now.ToString("ddd dd-MM-yyyy hh:mm"); }

private void label3_Click(object sender, EventArgs e) {

}

private void label1_TextChanged(object sender, EventArgs e) {

}

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) {

}

private void pictureBox1_Click(object sender, EventArgs e) {

}

private void pictureBox4_Click(object sender, EventArgs e) {

}

private void pictureBox2_Click(object sender, EventArgs e) {

}

private void pictureBox3_Click(object sender, EventArgs e) {

}

private void pictureBox6_Click(object sender, EventArgs e) {

}

private void timer2_Tick(object sender, EventArgs e) {

double value = Convert.ToDouble(label4.Text); double batassuhu = Convert.ToDouble("36.70"); if (value >= batassuhu)

{

label5.Text = "Temperature Tinggi"; } else { label5.Text = "Normal"; } }

private void label5_Click(object sender, EventArgs e) {

}

private void webCameraImageBoxRGB_Click(object sender, EventArgs e) {

}

private void label2_Click_1(object sender, EventArgs e) {

}

private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e) {

private void dataGridView1_CellContentClick_2(object sender, DataGridViewCellEventArgs e) {

}

private void label7_Click(object sender, EventArgs e) {

}

private void groupBox3_Enter(object sender, EventArgs e) {

}

private void button4_Click(object sender, EventArgs e) {

label9.Text = "0"; label10.Text = "0"; try

{

string MyConnection2 = "Server=localhost;Database=datapengunjung;Uid=root;Pwd=;"; string Query = "delete from data";

MySqlConnection MyConn2 = new MySqlConnection(MyConnection2); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MySqlDataReader MyReader2; MyConn2.Open(); MyReader2 = MyCommand2.ExecuteReader(); MessageBox.Show("Data Deleted"); dataGridView1.DataSource = dataBindingSource1.DataSource; dataGridView1.Update(); while (MyReader2.Read()) { } MyConn2.Close(); }

catch (Exception ex) {

MessageBox.Show(ex.Message); }

LAMPIRAN 2

Hasil Perancangan dan Pengujian Pendeteksi Wajah dan Pendeteksi Suhu Tubuh 1. Hasil perancangan Aplikasi Pendeteksi Wajah dan Pendeteksi Suhu Tubuh

2. Hasil pengujian alat (sensor mlx90614, LCD 16x2, Buzzer, Aplikasi Visual Studio) dan pengukuran Thermal (sebagai pembanding)

4. Hasil Pengujian Deteksi Wajah menggunakan masker dan tidak menggunakan masker

Dokumen terkait