Ask Your Question
0

lheibph = LBPHFaceRecognizer.create();

asked 2020-06-28 13:44:21 -0500

moses gravatar image

updated 2020-06-29 02:05:18 -0500

berak gravatar image

I am trying to train the my images and failing to execute thios line of code lheibph = LBPHFaceRecognizer.create(); I think it might be the ussue of face in the 4.3 opencv i downloaded, it does not have the face module.. where can i get one... only have the opencv-430.jar and thw windows dll file.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-06-29 01:16:25 -0500

berak gravatar image

updated 2020-06-29 01:24:54 -0500

only have the opencv-430.jar and thw windows dll file.

if that's from the prebuilt opencv win-pack -- it does not contain any of the contrib modules

you'll have to build from src with the opencv_contrib repo which will require:

  • apache ant
  • cmake
  • a c++ compiler (visual studio or mingw)

in the meantime, maybe you want to try out dnn based face recognition:

import org.opencv.core.*;
import org.opencv.dnn.*;
import org.opencv.imgcodecs.*;
import org.opencv.imgproc.*;

public class FaceRecognition {
    public static Mat process(Net net, Mat img) {
        Mat inputBlob = Dnn.blobFromImage(img, 1./255, new Size(96,96), new Scalar(0,0,0), true, false);
        net.setInput(inputBlob);
        return net.forward().clone();
    }
    public static void main(String[] args) {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

        Net net = Dnn.readNetFromTorch("c:/data/mdl/openface.nn4.small2.v1.t7");
        Mat feature1 = process(net, Imgcodecs.imread("Abdullah_Gul_0004.jpg")); 
        Mat feature2 = process(net, Imgcodecs.imread("Abdullah_Gul_0007.jpg")); 
        double dist  = Core.norm(feature1,  feature2);
        if (dist < 0.6)
            System.out.println("SAME !");
    }
}
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-06-28 13:44:21 -0500

Seen: 33 times

Last updated: Jun 29