I am using OpenCV v4.20 and PyCharm IDE. I want to use SIFT algorithm. But I get this error. I looked for solutions of this error on the internet but none of them did help me. Do you know the solution of this error? (With pip I can install at least 3.4.2.16 version of OpenCV)
Here is my error:
Traceback (most recent call last):
File "C:/Users/HP/PycharmProjects/features/featuredetect.py", line 7, in
sift = cv.xfeatures2d_SIFT.create()
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1210: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'cv::xfeatures2d::SIFT::create'
Here is my code:
import cv2 as cv
image = cv.imread("the_book_thief.jpg")
gray_image = cv.cvtColor(image,cv.COLOR_BGR2GRAY)
sift = cv.xfeatures2d_SIFT.create()
keyPoints = sift.detect(image,None)
output = cv.drawKeypoints(image,keyPoints,None)
cv.imshow("FEATURES DETECTED",output)
cv.imshow("NORMAL",image)
cv.waitKey(0)
cv.destroyAllWindows()
SIFT's patent has expired in last July. in versions > 4.4, the detector init command has changed to cv2.SIFT_create().
If you're not using opencv's GUI, It's recommended to install the headless version: pip install opencv-python-headless
Unfortunately, according to this Github issue, SIFT no longer available in opencv > 3.4.2. Since you're using OpenCV v4.2.0, it's not included even if you have installed pip install opencv-contrib-python as shown in this post. A work around is to downgrade to any previous OpenCV version that includes SIFT (I believe any version below 3.4.3). I've been successful when downgrading to v3.4.2.16.
pip install opencv-python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16
Using your code with v3.4.2.16, SIFT seems to work
I had the same issue previously. I had tried all methods but finally a very simple method work for me which has already answered by many. However, there is a little change in my approach.
Step 1:
Uninstall the previously install opencv library
pip uninstall opencv-python
Step 2:
Install opencv contrib library due to copyright issue. Here, we are using version 3.4.2.17
pip install opencv-contrib-python==3.4.2.17
opencv contrib library installation error
The above figure shows version 3.4.2.16 not found error. Hence, I tried with version 3.4.2.17. If this version doesn't work, try other versions of 3.4.x.
Step 3:
Then run the following
import cv2
sift = cv2.xfeatures2d.SIFT_create()
That's all. It works for me. I hope it works for you as well.
I had the same issue, after a lot of attempts, I tried installing opencv-contrib-python several times, but it worked just today. Just to be sure I installed both opencv-python and opencv-contrib-python.
pip install opencv-python
And
pip install opencv-contrib-python
The version that installed was 4.4.0.46 for both opencv-python and opencv-contrib-python. In case the later versions don't support it (A few of the previous versions didn't support SIFT, the one from a month ago, the latest opencv-contrib-python patch was released on Nov 2nd, 2020).
The solution to your problem should be installing opencv-contrib-python-nonfree (available via pip).
$ pip install opencv-contrib-python-nonfree
As the error states SIFT is patented and therefore not included into OpenCV for license reasons. It's included in the nonfree part.
I need to install matplotlib on Python 3.6.2 but when trying to install it getting this error (installing matplotlib package for designing the graphs.)The error is :-
Could not find a version that satisfies the requirement install (from versions: )
No matching distribution found for install”
operating system is Windows 10 -64 bit.
I tried to install the package from same link shared as https://www.lfd.uci.edu/~gohlke/pythonlibs/ .
but the same error appears.
I tried to install from command line plus from blue screen command python packagename.setup and it ended up throwing mentioned error.
it seems for python version 3.6.2 package matplotlib version 3.0.2 can not be installed because each time same error keeps populating as mentioned in previous post.
Can we use a similar other package for pie charts or graphs etc. as matplotlib version 3.0.2 is not getting installed because of mentioned error?
Have you tried installing it with "python3 -m pip install matplotlib"? Matplotlib should work with your Python version, maybe you are accidentally trying to install it for an older Python version.
This question already has answers here:
TensorFlow not found using pip
(60 answers)
Closed 4 years ago.
this is my symptom:
[shankai#shankai ~]$ pip3 install tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
my python : 3.7 64bit
os : ArchLinux
As listed at the pypi tensorflow page tensorflow is currently just available for Python 3.6, not for Python 3.7.
Either change your setup to Python 3.6 or build Tensorflow from source.
Try this (as suggested in this post):
python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
You should always check the official documentation of any library, module or free software you start using. You could have found this solution by checking the official documentation.
I have tried to install Python3.7 for Windows. After that I tried to install packages such as numpy, all works fine. However, when I tried to install matplotlib, the following error found:
* The following required packages can not be built:
* freetype, png
* Please check http://gnuwin32.sourceforge.net/packa
* ges/freetype.htm for instructions to install
* freetype
* Please check http://gnuwin32.sourceforge.net/packa
* ges/libpng.htm for instructions to install png
And then when I tried to install opencv-python, I got the following error:
Could not find a version that satisfies the requirement opencv-python (from versions: )
No matching distribution found for opencv-python
How can I fix the problems?
Python 3.7 just released 2 days ago and not many modules are not supported on Python 3.7 yet. If you don't really need Python 3.7, then downgrade to Python 3.6 to download packages.
Or
Download Anaconda 5.2 to use matplotlib and opencv in Python 3.6. Here is Anaconda Download link for Windows: [link] (https://www.anaconda.com/download/#windows)
I recommend to download Anaconda for using both matplotlib and opencv.
I'm trying to install an older version of SciPy (either 0.16.1 or 0.17.0), but when I try to use pip I get the result:
pip install scipy==0.16.1
I get the following message
Failed building wheel for scipy
So I found the .whl file here https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy but the problem is that the version here is 1.0.1, and I can't seem to find any older ones, even in the SciPy website (there are for linux and mac)
.
.
PS.
I need to use either of this versions because I'm trying to run Theano on a GPU, and the tutorial provided here http://deeplearning.net/software/theano/install_windows.html says this version is a requirement if there is any tutorial that is better and more up-to-date I would be appreciated