(Java)Deteksi Wajah menggunakan OpenCV

Face Detctio

 package processing;
import gab.opencv.*;

import java.awt.Rectangle;

import processing.core.PApplet;

public class facedetection extends PApplet{
	OpenCV opencv;
	Rectangle[] faces;
	
	//membuat panjang dan lebar diambil dari ukuran gambar
	public void setup() {
		  opencv = new OpenCV(this, "test1.jpg");
		  size(opencv.width, opencv.height);

		  opencv.loadCascade("C:\\Users\\Jarod OD\\Downloads\\haarcascade_frontalface_alt.xml");  
		  faces = opencv.detect();
		}

		
		public void draw() {
		  image(opencv.getInput(), 0, 0);

		  noFill();
		  stroke(0, 255, 0);
		  strokeWeight(3);
		  for (int i = 0; i < faces.length; i++) {
		    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
		  }
		}

}

https://www.dropbox.com/sm/create/Java/FaceDetection.rar

Advertisements

Published by

jarcode

hello I am jarcode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s