Message thread on Webots General

opencv path in python for ubuntuby aysegul ucar (Webots PRO - 31) 2019-01-07 09:40:34
R2019a
R2018b academic pro

Dear Concern,
We are using Ubuntu 16.04 and python 2.7.
We cant add to opencv to our python controller.
Could you please give an example lines for adding path? Previously many thanks
the error is:

INFO: my_controller_klavye: Starting: "python -u "my_controller_py" "
INFO: supervisor: Starting: "python -u "supervisor.py" "
[my_controller_] Traceback (most recent call last):
[my_controller_] File "my_controller_.py", line 9, in <module>
[my_controller_] import cv2
[my_controller_] ImportError: /usr/lib/x86_64-linux-gnu/libopencv_video.so.2.4: undefined symbol: _ZNK2cv13AlgorithmInfo4nameB5cxx11Ev
WARNING: 'my_controller_' controller exited with status: 1.
Re: opencv path in python for ubuntuby David Mansolino (Webots PRO - 358) 2019-01-07 11:16:34
Hi Aysegul,

We do provide an example of python 2.7 controller using opencv, please have a look at the 'visual_tracking' controller of the 'samples/robotbenchmark/visual_tracking' simulation.

You can also find the relative documentation here: https://www.cyberbotics.com/doc/guide/using-python#linux-libraries

Best,
David
Re: opencv path in python for ubuntuby aysegul ucar (Webots PRO - 31) 2019-01-07 12:14:39
I have previously used these commands.Later, import cv2 does not work again.

Linux Libraries
Use the pip command to install OpenCV:

sudo apt-get install python-pip
sudo pip install opencv-python
Re: opencv path in python for ubuntuby David Mansolino (Webots PRO - 358) 2019-01-07 16:31:15
It seems your OpenCV installation is somehow corrupted,
Is the 'visual_tracking' controller we are distributing working?
You should probably try uninstalling and re-installing OpenCV.
Re: opencv path in python for ubuntuby aysegul ucar (Webots PRO - 31) 2019-01-08 10:34:58
Thanks David,

'visual_tracking' controller is working.

In terminal, python 2.7 and import cv2 are working also.

Best regards

Re: opencv path in python for ubuntuby David Mansolino (Webots PRO - 358) 2019-01-08 14:39:20
I am sorry but this is not the correct 'visual_tracking' controller (this one is not using openCV) I was mentioning in my previous message the one of 'samples/robotbenchmark/visual_tracking'.

Best regards,
David
Re: opencv path in python for ubuntuby aysegul ucar (Webots PRO - 31) 2019-01-08 15:19:55
Many thanks

Regards

Forum closed

This forum is closed, please ask technical questions about Webots on Stack Overflow or open a support ticket.

COMMUNITY CHAT (Discord) Discord