1 #!/usr/bin/env python 2 3 import cv2.cv as cv 4 5 def precornerdetect(image): 6 # assume that the image is floating-point 7 corners = cv.CloneMat(image) 8 cv.PreCornerDetect(image, corners, 3) 9 10 dilated_corners = cv.CloneMat(image) 11 cv.Dilate(corners, dilated_corners, None, 1) 12 13 corner_mask = cv.CreateMat(image.rows, image.cols, cv.CV_8UC1) 14 cv.Sub(corners, dilated_corners, corners) 15 cv.CmpS(corners, 0, corner_mask, cv.CV_CMP_GE) 16 return (corners, corner_mask) 17