What is the cv2.cv replacement in OpenCV3?

后端 未结 1 1199
执念已碎
执念已碎 2020-12-13 19:37

I\'m using OpenCV3, and with the python bindings there is no cv2.cv module:

In [1]: import cv2

In [2]: from cv2 import cv
---------------------         


        
1条回答
  •  -上瘾入骨i
    2020-12-13 19:51

    From OpenCV 2.X OpenCV 3.0 a few things changed.

    Specifically:

    • cv2.cv doesn't exists in OpenCV 3.0. Use simply cv2.
    • some defines changed, e.g. CV_BGR2HSV is now COLOR_BGR2HSV.

    So you need to change this line:

    hsv_im = cv2.cvtColor(image, cv2.cv.CV_BGR2HSV)
    

    to:

    hsv_im = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
    

    0 讨论(0)
提交回复
热议问题