beta
beta

Reputation: 55

Not able to find Face and FaceRecognition classes

I am working on Face Recognition java project using OpenCV 3.4.0. For that using createFisherFaceRecognizer(0,1500) method but OpenCV doesn't contain this class and method. Does anyone know about OpenCV? Please let me know how to use it.

These are imports

import org.opencv.face.Face;
import org.opencv.face.FaceRecognizer;

Thanks in advance.

Upvotes: 3

Views: 1885

Answers (2)

KRISHNA MISHRA
KRISHNA MISHRA

Reputation: 29

org.opencv.face is not available with OpenCV. For that, opencv-contrib is required which can be easily added. Follow the link:

opencv-contrib library

Upvotes: 0

There is another thing called OpenCV-contrib that is required to run the following Face class .

This is the GitHub repo link . Read the README.md

Follow the given steps : -

  1. Download the original OpenCV repo and the contrib repo from GitHub.

  2. Go to opencv_contrib/modules/face and open cmakeLists.txt with any editor . Now find the line that begins with ocv_define_module and add the word 'java' (no quotes) in the end .

    [Looks like:-

    ocv_define_module(face opencv_core opencv_imgproc opencv_objdetect WRAP python java)]

3.Compile using cmake using this : cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=path to opencv_contrib

Use the generated jar!

PS:In windows , I don't think the default .exe opencv installer contains the face classes , so its better to build with cmake .

Upvotes: 2

Related Questions