I want to use SIFT. I've already tried this code:
import cv2
import numpy as np
img = cv2.imread('1.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
sift = cv2.xfeatures2d.SIFT_create()
kp = sift.detect(gray,None)
img=cv2.drawKeypoints(gray,kp,img)
cv2.imwrite('sift_keypoints.jpg',img)
But I get this error:
./sifttt.py: line 3: syntax error near unexpected token `('
./sifttt.py: line 3: `img = cv2.imread('1.jpg')'
I don't know if I need to install something or if I need to do something else?