0
votes

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

1
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.berak
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.Daniel Koczuła
^^ yes, just adapt to the newer cv2 api, those calls do no more existberak
So i just have to change all functions from cv to cv2?Daniel Koczuła
yes, exactly. (and you should have done that long ago already)berak

1 Answers

3
votes

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(...)