0

I'm trying to run a face recognition example using javacv, but there is a mismatch in the methods arguments types. I'm using the following maven dependencies:

        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacv</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.bytedeco.javacpp-presets</groupId>
            <artifactId>opencv</artifactId>
            <version>3.0.0-1.1</version>
        </dependency>
        <dependency>

I'm referring to this example: http://pcbje.github.io/misc/2012/12/01/doing-face-recognition-with-javacv.html

Imports:

import static org.bytedeco.javacpp.opencv_face.createFisherFaceRecognizer;
import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2GRAY;
import static org.bytedeco.javacpp.opencv_imgproc.cvCvtColor;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvLoadImage;
import static org.bytedeco.javacpp.opencv_core.IPL_DEPTH_8U;
import java.io.File;
import java.io.FilenameFilter;

import org.bytedeco.javacpp.opencv_core.IplImage;
import org.bytedeco.javacpp.opencv_core.Mat;
import org.bytedeco.javacpp.opencv_core.MatVector;
import org.bytedeco.javacpp.opencv_face.FaceRecognizer;

The only difference is that they are using com.googlecode.javacv, but as far as I understand this is old. However I downloaded those jars from http://www.java2s.com/Code/Jar/j/Downloadjavacvjar.htm, but I'm still not able to compile successfully.

Can you please advice. Thank you.

[SOLVED] - Please refer to this example

mdp
  • 171
  • 1
  • 1
  • 8
  • 1
    can you add also error message – HRgiger Mar 09 '16 at 16:33
  • error messages: 1. images.put(counter, grayImg); The method put(long, opencv_core.Mat) in the type opencv_core.MatVector is not applicable for the arguments (int, opencv_core.IplImage) 2. faceRecognizer.train(images, labels); The method train(opencv_core.MatVector, opencv_core.Mat) in the type opencv_face.FaceRecognizer is not applicable for the arguments (opencv_core.MatVector, int[]) 3. int predictedLabel = faceRecognizer.predict(greyTestImage); The method predict(opencv_core.Mat) in the type opencv_face.FaceRecognizer is not applicable for the arguments (opencv_core.IplImage) – mdp Mar 09 '16 at 16:39
  • 1
    did you fix this? im facing same problem, trying to replace all changes but i can't replace old predict(IplImage, int[], double[]); by this one opencv_face.predict(Mat src, int[] label, double[] confidence); – Ninja Coding Aug 09 '16 at 13:33
  • @Kuriel - try first converting IplImage to Mat: `IplImage greyTestImage = IplImage.create(testImage.width(), testImage.height(), IPL_DEPTH_8U, 1); **Mat imgMat = new Mat(img);** int predictedLabel = faceRecognizer.predict(imgMat);` – mdp Aug 24 '16 at 15:55
  • @Kuriel - Please see https://github.com/bytedeco/javacv/blob/master/samples/OpenCVFaceRecognizer.java – mdp Aug 25 '16 at 10:50

0 Answers0