Ask Your Question
0

matchShapes python return error

asked 2014-10-29 04:07:45 -0600

bonny gravatar image

updated 2014-10-29 04:30:24 -0600

berak gravatar image

Hello... I try to use matchShapes in python but got error.

Traceback (most recent call last):
File "ZobnicekSlika.py", line 72, in <module> print cv2.matchShapes(cifra2, co, cv2.CONTOURS_MATCH_I1, 0.0) AttributeError: 'module' object has no attribute 'CONTOURS_MATCH_I1'

The line on question is: print cv2.matchShapes(cifra2, co, cv2.CONTOURS_MATCH_I1, 0.0)

I use python 2.7 and opencv 3.0 Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-10-29 04:29:46 -0600

berak gravatar image

updated 2014-10-29 04:38:40 -0600

ok, looks like you found a bug, those constants were not properly mapped to the c++ interface (thus ignored by the python wrapper)

actually it's just a simple enum (imgproc/types_c.h):

/* Shape matching methods */
enum
{
    CV_CONTOURS_MATCH_I1  =1,
    CV_CONTOURS_MATCH_I2  =2,
    CV_CONTOURS_MATCH_I3  =3
};

so, use the numerical values for now (1 in your case).

edit flag offensive delete link more

Comments

Thanks... Work now.

bonny gravatar imagebonny ( 2014-10-29 05:51:11 -0600 )edit

Question Tools

Stats

Asked: 2014-10-29 04:07:45 -0600

Seen: 1,093 times

Last updated: Oct 29 '14