this is my code to detect and display keypoints (im using opencv 3.1.0 and python 2.7 )
import cv2
import numpy as np
img = cv2.imread('info-tabs3.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
sift = cv2.xfeatures2d.SIFT_create()
kp = sift.detect(gray,None)
pts = np.float([kp[idx].pt for idx in len(kp)]).reshape(-1, 1, 2)
print 'The list of detected keypoints is:' pts.pt
img=cv2.drawKeypoints(gray,kp,img)
cv2.imwrite('sift_keypoints.jpg',img)
cv2.imshow('window',img)
cv2.waitKey(10000)
cv2.destroyAllWindows()
the erreor displayed is :
File "sift.py", line 10
print 'The list of detected keypoints is:' pts.pt
^
SyntaxError: invalid syntax
as you can see im getting a syntax error, any corrections in the code then please do tell .
↧