Ask Your Question
0

Opencv GUI with GTK 2 - SOLVED ! ! !

asked 2015-03-20 09:15:37 -0600

updated 2015-03-20 12:17:47 -0600

I'm building OpenCV from source for Raspberry PI. Now I'm able to build OpenCV and my own program. Everything is working, except the highgui. And I have set the flag for GTK and GTK2 in cmake but it looks like that during the compilation GTK 2 isn't found and the lib is build without it. So the question:

How I can check if the GTK2 is found and if is not, how to set manually the path for GTK2 ?

p.p. The 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 /home/hristov/workspace/opencv/modules/highgui/src/window.cpp, line 534
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/hristov/workspace/opencv/modules/highgui/src/window.cpp:534: error: (-2) 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 function cvShowImage

Aborted

p.p.p. Any ideas ?

-- checking for module 'gtk+-2.0'
-- package 'gtk+-2.0' not found

p.p.p.p. I think that there is problem with the pkg-config. It doesn't find any of the packages. I try to set PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH but it still doesn't find anything.

SOLUTION: I found out, that you have to set PKG_CONFIG_PATH to the folder, where are the .pc files. So in my case (for Raspberry Pi with raspbian and cross compilation) is : /you_copy_of_the_root_fs/usr/lib/arm-linux-gnueabihf/pkgconfig/

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-10 05:22:13 -0600

Hello Spas Hristov,

I have been receiving the same error as you have, due to which I have performed n number of rebuilds with gtk+2, but still am receiving the same error!! Now, I came across your solution, and I think it could help solve my problem, but I still have a small query regarding it. Do you set the path for PKG_CONFIG_PATH on your ARM platform (Rasp Pi for you) or on the PC platform (Ubuntu PC i assume)? Because, it is already set to the described path on the ARM platform while it is different on the PC Linux platform. More details of the current path is shown below:

PKG_CONFIG_PATH in PC(Ubuntu):
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

PKG_CONFIG_PATH in ARM (Embedded platform):
/usr/local/lib/arm-linux-gnueabihf/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

I cross-compile on my Ubuntu PC using the following command:

arm-linux-gnueabihf-g++ -o example example.cpp -I/usr/lib/opencv_arm/install/include -L/usr/lib/opencv_arm/install/lib -lopencv_core -lopencv_imgcodecs -lopencv_highgui -lopencv_video -lopencv_imgproc -lopencv_videoio -lopencv_features2d -lopencv_flann -lopencv_ml -lopencv_photo -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d

Another point which may be helpful is that, I have build OpenCV for both these platforms - PC (Ubuntu) and Embedded (cross compile), and it works perfectly for the PC(Ubuntu), whereas for the embedded platform I am facing the GTK+2 issue.

Thanks!

edit flag offensive delete link more

Comments

plse check this problem how to solve :terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.3) /opt/opencv-3.4.3/modules/highgui/src/window.cpp:615: error: (-2: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 function 'cvNamedWindow'

Aborted

opencv-3.4.3 gravatar imageopencv-3.4.3 ( 2019-08-08 04:03:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-20 09:15:37 -0600

Seen: 25,493 times

Last updated: Feb 10 '17