Opencv 3.0 python imshow error

I am using OpenCV 3.0 with python 2.7.6 and ROS Indigo. I installed it and will try to do some discovery of the ORB object. Ironically, all actual detection codes seem to work without problems. The code that does not work is imshow. He gives this error:

OpenCV error: Unspecified error (function not implemented). Rebuild the library with support for Windows, GTK + 2.x or Carbon. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, -run cmake or configure the script) in cvShowImage, file / tmp / buildd / ros -indigo-opencv3-2.9.6-1trusty-20150512-2345 /modules/highgui/src/window.cpp line 534

I did not see this during my search. Any help?

+1
source share
2 answers

As the message says, you need to rebuild the library using gtk. Go into your OpenCV folder and create a new folder called Release.

cd ~/OpenCV mkdir Release cd Release 

Now you need to rebuild OpenCV. Use the following command

 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON .. 

Remember to use WITH_GTK=ON when building. After that, enter the following command

 make sudo make install 

Now run your code. This should make it work. You can delete the old folder.

+2
source

The complete process involves recompiling OpenCV 3 and copying these new compiled libraries with the correct ROS environment settings.

I encountered the same problem when programming the Baxter robot and had to solve it.

So, you must do the following:

  • Download the latest stable version http://opencv.org/downloads.html

    • Take it to some place and follow the steps of KiranCP. This will take some time depending on your computer.
    • Upon completion, you need to copy the libraries that are shown in the next step.
    • Information taken from this site → https://sites.google.com/site/rameyarnaud/research/ros/latest-opencv-in-ros but I will post the information here:

       sudo chmod a+rw -R /opt/ros/`rosversion -d`/lib/ mkdir /opt/ros/`rosversion -d`/lib/libopencv_backup mv /opt/ros/`rosversion -d`/lib/libopencv*.so* /opt/ros/`rosversion -d`/lib/libopencv_backup cp <OPENCV_BUILD_FOLDER>/lib/libopencv* /opt/ros/`rosversion -d`/lib/ ls -hal /opt/ros/`rosversion -d`/lib/libopencv* 

      Your ROS environment must be configured correctly, otherwise rosversion will return.

After that, you can use OpenCV 3 and display it correctly.

+1
source

Source: https://habr.com/ru/post/1014357/


All Articles