Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV 3 Python

Tags:

python

opencv

I just upgraded my OpenCV version from 2.4 to 3.1. I'm using python with it. Before upgrading, the following code would return the label of the predicted image and the confidence label:

label, confidence = model.predict(test_sample_image)

However, after the upgrade, the above code gives an error:

Traceback (most recent call last):
  File "recognize.py", line 45, in <module>
    label, confidence = model.predict(test_sample_image)
TypeError: 'int' object is not iterable

meaning that an integer is returned instead of a tuple as before. So how do I get the confidence?

like image 990
Denny Avatar asked Jul 23 '26 23:07

Denny


1 Answers

I've think I've found the solution to your problem. Click here

  • Open the file: opencv_contrib/modules/face/include/opencv2/face.hpp

  • If you go to line 259 on that file you should find it different than what was in the repositiory

  • Head over to opencv/build
  • And rebuild via (make -j8, make install)

It should just work after that. Cheers!

like image 200
Mikebarson Avatar answered Jul 25 '26 12:07

Mikebarson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!