3

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.