Hello! This is a simple tutorial on face detection iin Java. The first step will be to download OpenCV from their website. Their website can easily be accessed from google. First, we need to add a class called Mat2Image. This class simply sets up our video capture device. It can be downloaded here! First we make the class that sets up our video capture device. This, unlike the Mat2Image, creates the capture device, instead of creating the Matrix, or Mat. So, first, we type the following code:
This loads the native libraries. Now, we load the Cascade classifiers. This loads the XML file that will tell opencv how to find points on someone’s face. To do this, we type:
CascadeClassifier face_cascade =new CascadeClassifier(“C:/Users/Squiva/Desktop/openCV/opencv/sources/data/haarcascades/haarcascade_frontalface_alt.xml”);
Now that we have loaded our Cascade classifier, we can instantiate the video capture device.
Continue reading “OpenCV Java face detection”