cv2.boxPoints() used in tutorials does not exist in opencv 2.4.8 [closed]

asked 2014-04-23 08:50:35 -0600

foulques.nera gravatar image

Hello, In order to extract the rotated box from a contour, I used followin python script:

# cnt is a contour occurence
rect = cv2.minAreaRect(cnt)
box = cv2.boxPoints(rect)

And following error occurs : ''module' object has no attribute 'boxPoints'

Please help me.

Best regards.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-10 14:02:14.386694

Comments

where did you find the tutorial ? it seems, 3.0 has it, but 2.4.8 not.

berak gravatar imageberak ( 2014-04-23 11:22:59 -0600 )edit

Hello, You're right. It is tutorial

http://docs.opencv.org/trunk/doc/py_tutorials/py_imgproc/py_contours/py_contour_features/py_contour_features.html#contour-features

But, First) I have not found how to know "programatically" the exact version of openCV installed on the computer (I know that I have download the package 2.4.8, but...). Second) I don't know where to find the OpenCV release 3 for Windows and for Raspbian ?

Best regards

foulques.nera gravatar imagefoulques.nera ( 2014-04-23 12:19:11 -0600 )edit
  1. yes, those tutorials use 3.0 code.
  2. cv2.getBuildInformation() will tell you
  3. usually, you have to build 3.0 from src. there was a 'technical preview' binary version for 3.0 /win, but i can't find it.
berak gravatar imageberak ( 2014-04-23 12:37:55 -0600 )edit

It's ok. I have found the package on SourceForge.

As I need Python lib, I only unpack and copy the file cv2.pyc in python site-package folder. the function boxPoints exists.

But for release, the cv2.getBuildInformation() gives a strange result:

General configuration for OpenCV 3.0.0-tp2 ===== Version control: 2.4.8-3169-g9f8de6

Best regards.

foulques.nera gravatar imagefoulques.nera ( 2014-04-24 05:28:54 -0600 )edit

oh, nice to hear. if you're confused about the strange Version control numbers, - they're related to git, don't worry.

berak gravatar imageberak ( 2014-04-24 06:11:09 -0600 )edit

this solution didn't work for me is there an alternate? where is the source for opencv? is there an alternate method call?

lapolonio gravatar imagelapolonio ( 2014-07-15 13:10:05 -0600 )edit

@lapolonio either use opencv3.0, or, for 2.4, (maybe) fall back to cv2.cv.boxPoints()

berak gravatar imageberak ( 2014-07-15 13:14:28 -0600 )edit