0

I've installed on my raspberry opencv python module and everything was working fine. Today I've compiled a C++ version of OpenCV and now when I want to run my python script i get this error:

Traceback (most recent call last): File "wiz.py", line 2, in import cv2.cv as cv ImportError: No module named cv

5
  • please, stick with cv2. also, opencv3.0 does no more come with the deprecated cv2.cv. if your script requires the old api, consider updating that. Commented Dec 9, 2014 at 16:54
  • Ok, but when i change everything from cv to cv2 for example: imgHSV = cv.CreateImage(cv.GetSize(img), 8, 3) I get an error that the function doesnt exist. Commented Dec 9, 2014 at 16:57
  • 1
    ^^ yes, just adapt to the newer cv2 api, those calls do no more exist Commented Dec 9, 2014 at 16:57
  • So i just have to change all functions from cv to cv2? Commented Dec 9, 2014 at 17:01
  • yes, exactly. (and you should have done that long ago already) Commented Dec 9, 2014 at 17:05

1 Answer 1

3

Check the API docs for 3.0. Some python functions return more parameters or in a different order.

example: cv2.cv.CV_HAAR_SCALE_IMAGE was replaced with cv2.CASCADE_SCALE_IMAGE

or

(cnts, _) = cv2.findContours(...) now returning the modified image as well (modImage, cnts, _) = cv2.findContours(...)

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.