Opencv Gtk+2.X Error - "Unspecified Error (The Function Is Not Implemented...)"

OpenCV GTK+2.x error - Unspecified error (The function is not implemented...)

First check whether libgtk2.0-dev is installed properly. If you have installed aptitude package manager, run the following:

sudo aptitude search libgtk2.0-dev

It should return like this:

i  libgtk2.0-dev              - development files for the GTK+ library
p libgtk2.0-dev:i386 - development files for the GTK+ library

You need to build the files once again. Locate your OpenCV folder. Create a new folder and name it Release. Enter into this folder. For example,

cd /home/user_name/OpenCv
mkdir Release
cd Release

Now build using CMake with 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 put WITH_GTK=ON during CMake.

After this step, enter the command,

make
sudo make install

This should resolve your problem. If you have broken dependencies for libgtk2.0-dev, then install a fresh copy of libgtk2.0-dev using aptitude.

sudo aptitude install libgtk2.0-dev

error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support

Few frustration hours later, saw this solution under the comment of the first answer by Karthik Thilakan

pip uninstall opencv-python-headless -y 

pip install opencv-python --upgrade

This worked for me in the conda environment. Thanks Karthik! :)

OpenCV v1/v2 error: the function is not implemented

If it's giving you errors with gtk, try qt.

sudo apt-get install libqt4-dev
cmake -D WITH_QT=ON ..
make
sudo make install

If this doesn't work, there's an easy way out.

sudo apt-get install libopencv-*

This will download all the required dependencies(although it seems that you have all the required libraries installed, but still you could try it once). This will probably install OpenCV 2.3.1 (Ubuntu 12.04). But since you have OpenCV 2.4.3 in /usr/local/lib include this path in /etc/ld.so.conf and do ldconfig. So now whenever you use OpenCV, you'd use the latest version. This is not the best way to do it but if you're still having problems with qt or gtk, try this once. This should work.

Update - 18th Jun 2019

I got this error on my Ubuntu(18.04.1 LTS) system for openCV 3.4.2, as the method call to cv2.imshow was failing (e.g., at the line of cv2.namedWindow(name) with error: cv2.error: OpenCV(3.4.2). The function is not implemented.). I am using anaconda. Just the below 2 steps helped me resolve:

conda remove opencv
conda install -c conda-forge opencv=4.1.0

If you are using pip, you can try

pip install opencv-contrib-python

cvWaitKey: The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support

The path is still "there" because it is stored inside the library that you built. It is preserved because it is useful debugging information.

You built OpenCV without any GUI support. That's what the error means. It also says:

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 'cvWaitKey'

So you should rebuild OpenCV. Run cmake-gui and look at the output to understand what GUI backends could be possible, and what causes them to be unavailable. Browse the settings/variables and enable a GUI backend if none were enabled.

crosscompiled OpenCV, runtime Error: The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support

I still cannot address the error, but i managed to install opencv directly on my target platform.

maybe this solution could help you.

Due to limit computing power of our target platform. We need to make sure which opencv libraries are used in our program.

  1. We need to build a example binary(with x86 compiled) on our host computer, which can be executed on our host computer. Then we need to check its needed libraries from opencv.
#in terminal
ldd <your binary name>

  1. after you get your required libraries, you need to install them from source on your target platform. you can check it here

# Download and unpack sources
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
unzip opencv.zip

# create build folder
cd opencv
mkdir -p build && cd build

# cmake with limit modules.
cmake -DBUILD_LIST=<module1>,<module2> ..
make -j4
sudo make install

  1. ATTENTION: Something may go wrong with make, so you just have to install required packages on your target platform. In my case, i have to uninstall "libopenjp2-7" and reinstall it in order to make "imgcodecs" function compile successfully.

I hope this may help you. :D



Related Topics



Leave a reply



Submit