2012-11-24 02:57:22 +08:00
|
|
|
#/usr/bin/env python
|
|
|
|
|
2011-07-12 20:56:03 +08:00
|
|
|
import cv2.cv as cv
|
2011-05-17 23:52:23 +08:00
|
|
|
|
|
|
|
def precornerdetect(image):
|
2012-10-17 07:18:30 +08:00
|
|
|
# assume that the image is floating-point
|
2011-05-17 23:52:23 +08:00
|
|
|
corners = cv.CloneMat(image)
|
|
|
|
cv.PreCornerDetect(image, corners, 3)
|
|
|
|
|
|
|
|
dilated_corners = cv.CloneMat(image)
|
|
|
|
cv.Dilate(corners, dilated_corners, None, 1)
|
|
|
|
|
|
|
|
corner_mask = cv.CreateMat(image.rows, image.cols, cv.CV_8UC1)
|
|
|
|
cv.Sub(corners, dilated_corners, corners)
|
|
|
|
cv.CmpS(corners, 0, corner_mask, cv.CV_CMP_GE)
|
|
|
|
return (corners, corner_mask)
|