Python bindings for OpenCV3 missing modules

asked 2015-06-06 23:51:54 -0500

hoju gravatar image

I tried the Python examples in OpenCV3 and got some missing module errors:

$ python
>>> import cv2
>>> cv2.__version__
'3.0.0'

$ python asift.py
Traceback (most recent call last):
  File "asift.py", line 121, in <module>
    detector, matcher = init_feature(feature_name)
  File "/home/hoju/downloads/opencv-3.0.0/samples/python2/find_obj.py", line 28, in init_feature
    detector = cv2.xfeatures2d.SIFT_create()
AttributeError: 'module' object has no attribute 'xfeatures2d'

$ python feature_homography.py 
Traceback (most recent call last):
  File "feature_homography.py", line 94, in <module>
    App(video_src).run()
  File "feature_homography.py", line 75, in run
    draw_keypoints(vis, self.tracker.frame_points)
AttributeError: PlaneTracker instance has no attribute 'frame_points'

$ python gaussian_mix.py
Traceback (most recent call last):
  File "gaussian_mix.py", line 40, in <module>
    em = cv2.EM(cluster_n, cv2.EM_COV_MAT_GENERIC)
AttributeError: 'module' object has no attribute 'EM'

$ python letter_recog.py
Traceback (most recent call last):
  File "letter_recog.py", line 161, in <module>
    model = Model()
  File "letter_recog.py", line 61, in __init__
    self.model = cv2.RTrees()
AttributeError: 'module' object has no attribute 'RTrees'

The OpenCV bug page says to post problems here first, so here it is.

edit retag flag offensive close merge delete

Comments

2

the 1st one isn't a bug, to use SIFT or SURF, - you additionally need to download and build the contrib repo


but the last 3 are indeed bugs. the api changed, all ml classes are n cv2.ml now (do a help(cv2.ml) to see), and to create one, you'd have to call e.g. em = cv2.ml.EM_create()

let's try to fix them, then make a pr.

berak gravatar imageberak ( 2015-06-07 00:56:09 -0500 )edit
1

If you do not know what a PR is, than take a look here, it is basically a fix of the current library based on your findings.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-07 03:31:18 -0500 )edit