I am using opencv3.1.0. While I am trying to run:
import cv2.cv as cv
import cv2
cascade = cv.Load('/usr/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml')
I find that cv2.cv is not in opencv3, so I change cv2.cv to cv2 and then I get the error message in the title.
Any thoughts? Many thanks.
You are trying to load a classifier from a file, correct? According to the OpenCV3 documentation you should use CascadeClassifier for this. Example:
import cv2
cascade = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml')
Source: http://docs.opencv.org/3.0-beta/modules/objdetect/doc/cascade_classification.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With