Reinstall OpenCV from Scratch
Solution 1
I had the same problem once. I fixed the problem by completely uninstalling opencv and reinstalling it from source. There are some dependencies like ffmpeg you should install.
EDIT: To completely uninstall opencv
-
If you installed from source you can use the following command
make uninstall
run This command from build directory of the opencv source.
-
If you installed using pip
sudo pip uninstall opencv
-
If you Installed using apt-get
sudo apt-get remove python-opencv
sudo apt-get purge python-opencv
I hope this might help
Solution 2
I had the same error for a couple of weeks.So I decided to reinstall the opencv just like you did.
First,sudo pip uninstall opencv
or if you installed through apt-get,sudo apt-get remove python-opencv
After that,pip install opencv-contrib-python
It worked like a charm.Only getting error in video processing.Guess that would take a week to rectify that.
Source:See this if you need any clarification
Thidasa Pankaja
Passionate Software Engineer at Twire working towards achieving professional goals, with an active drive to learn new technologies. Skilled in JavaScript, React, Go, PostgreSQL etc. Strong engineering professional with a Bachelor of Science (Hons) focused in Information Technology from University of Moratuwa.
Updated on June 29, 2022Comments
-
Thidasa Pankaja almost 2 years
I'm having an error in OpenCV when I try to run a python code. I tried running
import cv2 import numpy as np import matplotlib.pyplot as plt img = cv2.imread("watch.jpg", cv2.IMREAD_GRAYSCALE) cv2.imshow('image', img) cv2.waitKey(0) cv2.destroyAllWindows()
But I'm getting 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 /home/pankaja/Desktop/OpenCV-tmp/opencv/modules/highgui/src/window.cpp, line 611 Traceback (most recent call last): File "/home/pankaja/PycharmProjects/ImageProcessing/imageprocess.py", line 8, in cv2.imshow('image', img) cv2.error: /home/pankaja/Desktop/OpenCV-tmp/opencv/modules/highgui/src/window.cpp:611: 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
with some errors finally I managed to install libgtk2.0-dev and pkg-config (The following packages have unmet dependencies OpenCV 3.2 Python 3.5), but still the it's giving the error
So, now I think of doing to do a fresh installation on both python 3.5 and OpenCV to fix the problem. How can I uninstall OpenCV completely?