I am using OpenCV 3.0 with python 2.7.6 and ROS Indigo. I installed it through and am attempting to do some ORB object detection. Ironically, all of the actual detection code seems to run without issue. The code that doesn't work is imshow. It gives this error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /tmp/buildd/ros-indigo-opencv3-2.9.6-1trusty-20150512-2345/modules/highgui/src/window.cpp, line 534
I haven't seen any of this during my googling. Any help?
As the message says, you need to rebuild the library with gtk.
Enter into your OpenCV folder and create a new folder with name 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
while building. After this, enter these command
make
sudo make install
Now run your code. This should make it work. You can delete the old build folder.
The complete process involves recompiling OpenCV 3 and copying those new compiled libraries with the correct options to the ROS environment.
I ran into the same issue while programming a Baxter robot and needed to solve it.
So the following needs to be done:
After this you should be able to use OpenCV 3 and imshow properly.