Why can't use `cv2.cv.BoxPoints` in OpenCV (Python)?

15,531

cv2.cv.BoxPoints was changed.

For OpenCV 3.x, use cv2.boxPoints instead.


For example:

>> import numpy as np
>> import cv2
>>> cv2.__version__
'3.3.0-dev'

>>> cnt = np.array([[0,0], [1,1], [2,0]])
>>> bbox = cv2.minAreaRect(cnt)
>>> pts = cv2.boxPoints(bbox)
>>> print(pts)
[[  9.99999940e-01   9.99999881e-01]
 [  5.96046448e-08   0.00000000e+00]
 [  9.99999940e-01  -9.99999881e-01]
 [  1.99999976e+00   0.00000000e+00]]
Share:
15,531
leo90
Author by

leo90

Updated on July 22, 2022

Comments

  • leo90
    leo90 almost 2 years

    I am a beginner in OpenCV. I want to make bounding box around my detected marker.

    Can you tell me how can I do it with OpenCV (Python)?

    I'm using Python 3.6.3 with openCV

    box =np.int0(cv2.cv.BoxPoints(marker))
    

    Output:

    Error showing cv2.cv2 has no module cv