Unable to create Recognzer Object

asked 2017-05-12 03:33:05 -0500

Syed Hasnain gravatar image

updated 2017-05-12 04:47:43 -0500

berak gravatar image

Hello, i am new to openCV java library. I want to create a face recognizer object in my java file but there is no face recognizer exist in my java code. Which files are necessary to import Facerecognizer.

import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfByte;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.CascadeClassifier;
import org.opencv.videoio.VideoCapture;
import java.util.Scanner;
public class FaceTrainer{
    public static void main(String[] args){
        FaceRecognizer rec=createLBPHFaceRecognizer();
    }
}
edit retag flag offensive close merge delete

Comments

the face recognizer classes were moved to opencv_contrib with opencv3, you you need to rebuild the opencv libs with those modules (see readme there)

then, java bindings for this are not enabled by default, try to append "java" at the end here so it says: WRAP python java)

last: Face.createLBPHFaceRecognizer(); .. maybe you can try demo code here

good luck, and please report back, how it went ... !

berak gravatar imageberak ( 2017-05-12 04:45:45 -0500 )edit