Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openCV: The function is not implemented

Trying to run a python script and it throws the following 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 cvDestroyAllWindows, file /io/opencv/modules/highgui
 /src/window.cpp, line 577
Traceback (most recent call last):
  File "/home/ldsvm/PycharmProjects/tagging/C1_DrawBboxesOnImages.py", line 
  116, in <module> cv2.destroyAllWindows()
cv2.error: /io/opencv/modules/highgui/src/window.cpp:577: 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  
 cvDestroyAllWindows

I have installed the libgtk2.0-dev and pkg-config and reinstalled opencv3 but still get the same error.

I am on CentOS.

like image 402
mallet Avatar asked May 02 '17 13:05

mallet


1 Answers

The simplest way is to remove the opencv packages update your conda and then find the missing package using third command.

conda remove opencv
conda update conda
conda install --channel menpo opencv

Another option is instead of using opencv built-in function use matplotlib for this....

import cv2
import matplotlib.pyplot as plt

img = cv2.imread('img.jpg',0)

plt.imshow(img, cmap='gray')
plt.show()
like image 63
Shahzaib Ali Avatar answered Oct 18 '22 09:10

Shahzaib Ali