Ask Your Question

zaguia's profile - activity

2017-01-27 01:26:41 -0600 received badge  Famous Question (source)
2016-04-15 09:55:21 -0600 received badge  Notable Question (source)
2016-02-13 18:32:33 -0600 received badge  Popular Question (source)
2015-08-17 01:44:58 -0600 commented question opencv 3 java face recognition example requested

I did not there was one allready build in the zip of opencv "opencv_java300.dll"..

2015-08-16 05:11:00 -0600 commented question opencv 3 java face recognition example requested

well I'm incapable of step 3.. I did not install visual studio because of it's terms... apparently cmake requires it (on windows) is't there a compiled !

2015-08-06 07:54:38 -0600 asked a question opencv 3 java face recognition example requested

For now on opencv 3 I'm succeeding face detection. but I could not even start face recognition. I could not find facerec.dll and I do not have the compilers to have it from cpp files... Can somebody give an opencv3 java example running face recognition against a database?

//here is the face detection example : (you should change the paths to files according to your computer...)
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import static org.opencv.imgcodecs.Imgcodecs.imread;
import static org.opencv.imgcodecs.Imgcodecs.imwrite;
import static org.opencv.imgproc.Imgproc.rectangle;
//import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
class DetectFaceDemo {
  public void run() {
    System.out.println("\nRunning DetectFaceDemo");
    // Create a face detector from the cascade file in the resources
    // directory.
    CascadeClassifier faceDetector = new CascadeClassifier("C:\\Users\\HP\\Downloads\\opencv\\opencv\\sources\\data\\lbpcascades\\lbpcascade_frontalface.xml");
    Mat image = imread("C:\\Users\\HP\\Desktop\\day12-face-detection-master\\2faces2.png");
    // Detect faces in the image.
    // MatOfRect is a special container class for Rect.
    MatOfRect faceDetections = new MatOfRect();
    faceDetector.detectMultiScale(image, faceDetections);
    System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
    // Draw a bounding box around each face.
    for (Rect rect : faceDetections.toArray()) {
        rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
    }
    // Save the visualized detection.
    String filename = "faceDetection.png";
    System.out.println(String.format("Writing %s", filename));
    imwrite(filename, image);
    //FaceRecognizer fr;//= new LBPHFaceRecognizer();
  }
}
public class HelloOpenCV {
  public static void main(String[] args) {
    System.out.println("Hello, OpenCV");
    // Load the native library.
    //System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    //System.load("C:\\Users\\HP\\Downloads\\opencv 2.4.11\\opencv\\build\\java\\x64\\opencv_java2411.dll");
    System.load("C:\\Users\\HP\\Downloads\\opencv\\opencv\\build\\java\\x64\\opencv_java300.dll");
    new DetectFaceDemo().run();
  }
}