Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: no suitable method found for predict(Mat) #642

Closed
hokage4 opened this issue Mar 14, 2017 · 6 comments
Closed

error: no suitable method found for predict(Mat) #642

hokage4 opened this issue Mar 14, 2017 · 6 comments
Labels

Comments

@hokage4
Copy link

hokage4 commented Mar 14, 2017

Hi,
i make project face recogntion and build it by gradle but when i build i have this error

home/project/hipi/examples/jcvhd/src/main/java/org/hipi/examples/HelloWorld.java:132: error: no suitable method found for predict(Mat)
int predictedLabel = faceRecognizer.predict(testImage);
^
method FaceRecognizer.predict(Mat,IntPointer,DoublePointer) is not applicable
(actual and formal argument lists differ in length)
method FaceRecognizer.predict(Mat,IntBuffer,DoubleBuffer) is not applicable
(actual and formal argument lists differ in length)
method FaceRecognizer.predict(UMat,int[],double[]) is not applicable
(actual and formal argument lists differ in length)
method FaceRecognizer.predict(UMat,IntPointer,DoublePointer) is not applicable
(actual and formal argument lists differ in length)
1 error
:examples:jcvhd:compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':examples:jcvhd:compileJava'.

Compilation failed; see the compiler error output for details.

can any one help me please.

@saudet
Copy link
Member

saudet commented Mar 15, 2017

It looks like that method was renamed to "predict_label" for some reason:
https://github.com/bytedeco/javacpp-presets/blob/master/opencv/src/main/java/org/bytedeco/javacpp/opencv_face.java#L435

@saudet saudet added the bug label Mar 15, 2017
@hokage4
Copy link
Author

hokage4 commented Mar 15, 2017

thank you i used predict_label and work successfully but i want Get the prediction with confidence.
predict_label not return confidence

@hokage4
Copy link
Author

hokage4 commented Mar 15, 2017

i want use this method to get confidence FaceRecognizer.predict(Mat,IntPointer,DoublePointer) if can.

or advise me if you have another way to get confidence
thank you

@saudet
Copy link
Member

saudet commented Mar 17, 2017

Yes, we can use that method. What is the issue?

@hokage4
Copy link
Author

hokage4 commented Mar 20, 2017

I used it in this way

Mat testImage = imread("//home//project//NetBeansProjects//newjavacv//aa.jpg"  , CV_LOAD_IMAGE_GRAYSCALE);
int predictedLabel = 0;
double con = 0.0;
faceRecognizer.predict(testImage, predictedLabel, con);

and the build.gradle is

jar {
  manifest {
    attributes("Main-Class": "org.hipi.examples.HelloWorld")
  }
dependencies{
compile project(':core')
compile group: 'org.bytedeco', name: 'javacv', version: '1.2'
compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.3.2'

}
from {
    configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
configurations {
    all*.exclude group: 'org.bytedeco', module: 'javacpp-presets'
    
}
}

and when i build it by gradle i have the this error

no suitable method found for predict(Mat,int,double)
faceRecognizer.predict(testImage, po, distance);
              ^
    method FaceRecognizer.predict(Mat,IntPointer,DoublePointer) is not applicable
      (argument mismatch; int cannot be converted to IntPointer)
    method FaceRecognizer.predict(Mat,IntBuffer,DoubleBuffer) is not applicable
      (argument mismatch; int cannot be converted to IntBuffer)
    method FaceRecognizer.predict(UMat,int[],double[]) is not applicable
      (argument mismatch; Mat cannot be converted to UMat)
    method FaceRecognizer.predict(UMat,IntPointer,DoublePointer) is not applicable
      (argument mismatch; Mat cannot be converted to UMat)
1 error
:examples:jcvhd:compileJava FAILED

How can solve this error ?

@saudet
Copy link
Member

saudet commented Mar 25, 2017

As per the commit above, I've fixed the call in the samples. Just do it the same way.

Thanks for reporting!

@saudet saudet closed this as completed Mar 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants