5

Using opencv libraries in c/c++ extensions for python

view full story
linux-howto

http://www.daniweb.com – Hi! I am trying to convert my c/c++ code into a python module. The code captures an image which it then runs some algorithms upon. For a start, I am trying to write a code that just captures an image. I am using opencv for the image capture (in the c/c++ code). In the compiling options, I compile the file with the opencv functions using the following options: Quote: g++ -g -fpic -c image.cpp -o image.o -lm `pkg-config --cflags --libs opencv` -I /u sr/include/python2.6/ -I /usr/local/include However, when I create the .so file (with all the .o files), I get the following error: Quote: g++ -shared test.o image.o -L /usr/local/lib -o test However, that gave me the following errors: [QUOTE]>>> import test Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: ./test.so: undefined symbol: cvQueryFrame/QUOTE] I then also added the .o files from the opencv library (libcv.a, libcvcore.a and libhighgui.a), however this gave me the following: Quote: >>> import test Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: ./test.so: undefined symbol: g_thread_functions_for_glib_use I guess this method is not the right one - I will have to keep hunting for more and more libraries. How can I get opencv to work? Thanks Kedar (General)