In [1]:
import sys, os
import numpy as np
import cv2
cv2.startWindowThread()


Out[1]:
0

In [15]:
img = cv2.imread('j:/dev/opencv_graph/TemcaGraphPy/SampleImages/test1.tif',0)
img8 = np.uint8(img)
print img.shape, img.dtype


(3840L, 3840L) uint8

In [30]:
#surf
# Create SURF object. You can specify params here or later.
# Set Hessian Threshold to 400
surf = cv2.xfeatures2d.SURF_create()
surf.setUpright(True)
surf.setHessianThreshold(8000)
kp, des = surf.detectAndCompute(img8,None)
len(kp)


Out[30]:
199

In [32]:
print surf.descriptorSize()


64

In [31]:
img2 = cv2.drawKeypoints(img,kp,None,(255,0,0),4)
cv2.imshow('surf', img2)
cv2.waitKey(0)


Out[31]:
-1

In [20]:
#sift
sift = cv2.xfeatures2d.SIFT_create()
kp = sift.detect(img8,None)
len(kp)
#imgOut = img8
imgO2 = cv2.drawKeypoints(img8,kp, None, color=(0,255,0), flags=0)
cv2.imwrite('sift_keypoints.jpg',imgO2)

cv2.imshow('imgOut', imgO2)
cv2.waitKey(0)


Out[20]:
-1

In [32]:
cv2.imshow('8bpp', img)
cv2.waitKey(0)


Out[32]:
(3840L, 3840L)

In [37]:
cv2.imshow('imgOut', imgOut)
cv2.waitKey(0)


Out[37]:
dtype('uint8')

In [17]:
imgOut.shape


Out[17]:
(3840L, 3840L)

In [18]:
imgOut.dtype


Out[18]:
dtype('uint8')

In [ ]:
cv2.xfeatures2d.