Tag Archives: SURF

S.U.R.F.

2 May

Speed Up Robust Feature extraction algorithm. For those who all are hearing this algorithm for the first time please visit wiki and understand a bit about it.

Now, from name you can guess its something about features. Here I am gonna tell you about its implementation.The following is the code in python using Opencv.

############################################################

import cv2

cap = cv2.VideoCapture(0)
ret,img = cap.read()
#im2 = cv2.imread(‘ex1.jpg’)
#im = cv2.cvtColor(im2,cv2.COLOR_BGR2GRAY)
while True:
ret,img = cap.read()
im= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
surfDetector = cv2.FeatureDetector_create(“SURF”)
surf = cv2.DescriptorExtractor_create(“SURF”)
keypoints = surfDetector.detect(im)
(l,d)= surf.compute(im,keypoints)

for kp in l:
x = int(kp.pt[0])
y = int(kp.pt[1])
cv2.circle(im,(x,y),2,(0,0,255))

cv2.imshow(“features”,im)
cv2.waitKey(1)

#############################################################