Ask Your Question
2

getting opencv to work with pydev

asked 2012-09-17 23:27:16 -0500

jmbldwn gravatar image

I'd sure like to use pydev (eclipse plugin) to develop opencv apps with python.

But, despite trying every imaginable trick I can't get pydev to do simple things like auto-complete or syntax checking on opencv calls.

I'm no expert, but it looks like the only access python has to opencv is the compiled extension cv2.so, and pydev isn't so sure about reading that file to do its thing.

Has anyone successfully gotten opencv working with pydev? In particular, opencv2?

I'm trying to do this on a mac, running Mountain Lion, but not sure if that is really the problem.

Thanks!

edit retag flag offensive close merge delete

Comments

I also keep facing this problem in one of my Eclipse installations. I'm running opencv from Homebrew. The interesting piece is that the interpreter in Pydev does recognize the cv2 library and it even autocompletes for the cv2 methods (but that maybe because it is using the interactive python shell instead of Eclipse's content assist).

However, I notice this was working on my other macbook, but it just happened that my SSD crash so I will have to a few weeks until it's fixed to verify why it worked there.

opencvslave gravatar imageopencvslave ( 2013-08-16 14:27:11 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2012-10-23 09:02:35 -0500

isaacchansky gravatar image

updated 2012-10-24 16:01:41 -0500

[edit] I misread your question, I am actually finding the same issue using win7, python 2.7, opencv 2.4.2 ... As far as I can tell the autocompletion and code hinting only works for the cv2 compiled file (which has been working fine for me). Not sure how to go about getting around this, aside from using dir([object]) function on any objects you're working with to see their attributes...

edit flag offensive delete link more
0

answered 2013-08-16 18:16:06 -0500

updated 2014-02-08 03:38:37 -0500

Set the important Interpreter's System PYTHONPATH (Libraries)

Don't forget to add Python's Lib path, such as:

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7

in addition to the usual site-packages

/usr/local/lib/python2.7/site-packages

Finally, add other paths for modules that only live inside eggs or that haven't been packaged (exist inside folders that don't have an __init__.py)

Nothing else really should be needed in PyDev

Pydev now auto-completes my cv2 methods as desired :)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2012-09-17 23:27:16 -0500

Seen: 3,279 times

Last updated: Feb 08 '14