Giter Site home page Giter Site logo

Comments (10)

appoll avatar appoll commented on August 24, 2024

Which opencv version is it that you are using? In opencv 3.x, the SIFT and SURF descriptors are part of the xfeatures2d submodule. Try the following to get an instance of a sift descriptor (similar for SURF):

sift = cv.xfeatures2d.SIFT_create()

from opencv2-python-tutorials.

Basilisvirus avatar Basilisvirus commented on August 24, 2024

Ok so i changed the code:

import cv2
import numpy as np

img = cv2.imread('home.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

sift = cv.xfeatures2d.SIFT_create()
kp = sift.detect(gray,None)

img=cv2.drawKeypoints(gray,kp)

cv2.imwrite('sift_keypoints.jpg',img)+

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'

rebuild the library?
I think i had CMake installed, cause i had several errors like this, but once i installed Pycharm IDE, i deleted the Cmake. I never understood what cmake does. Why did they removed the sift anyway?

from opencv2-python-tutorials.

biranchi2018 avatar biranchi2018 commented on August 24, 2024

I solved it by installing the opencv contrib python package

sudo pip3 install opencv-contrib-python

import cv2
sift = cv.xfeatures2d.SIFT_create()

from opencv2-python-tutorials.

priyanshgupta1998 avatar priyanshgupta1998 commented on August 24, 2024

I'm getting same error in opencv==4.1.0 and python3.x when i'm using
sirt = cv2.xfeatures2d.SIFT_create()

Error is
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: 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'
How can i resolve this?

from opencv2-python-tutorials.

zoldaten avatar zoldaten commented on August 24, 2024

I'm getting same error in opencv==4.1.0 and python3.x when i'm using
sirt = cv2.xfeatures2d.SIFT_create()

Error is
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: 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'
How can i resolve this?

You should rebuild openCV sift feature included as it is not free preinstalled.

from opencv2-python-tutorials.

Basilisvirus avatar Basilisvirus commented on August 24, 2024

as far as i can remember, sift is no longer part of opencv. I just re-notices this issue a year later.. Shall i close the issue?

from opencv2-python-tutorials.

zoldaten avatar zoldaten commented on August 24, 2024

as far as i can remember, sift is no longer part of opencv. I just re-notices this issue a year later.. Shall i close the issue?

Sure. But if you want to re-build opencv with surf - have a look here.

from opencv2-python-tutorials.

Basilisvirus avatar Basilisvirus commented on August 24, 2024

Thanks!

from opencv2-python-tutorials.

furqan5411 avatar furqan5411 commented on August 24, 2024

This is my error please guide:
Traceback (most recent call last):
File "C:/Users/Furqan Haider/Desktop/Sensation Home Work/Home Work 2/Python Camera Calibration/Stereo Image/Stereo_Test.py", line 7, in
sift = cv.SIFT()
AttributeError: module 'cv2.cv2' has no attribute 'SIFT'

from opencv2-python-tutorials.

Basilisvirus avatar Basilisvirus commented on August 24, 2024

As i have commented:
"as far as i can remember, sift is no longer part of opencv. I just re-notices this issue a year later.. Shall i close the issue?"
You may not be avle to use SIFT anymore. Look it up a bit more, you may find a way. zoldaten said you can rebuild opencv with surf.

from opencv2-python-tutorials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.