def center_from_good_features(matrix):
x, y = (0, 0)
weight = 0
corners = cv2.goodFeaturesToTrack(matrix, FEATURE_DETECT_MAX_CORNERS, FEATURE_DETECT_QUALITY_LEVEL,
FEATURE_DETECT_MIN_DISTANCE)
for point in corners:
weight += 1
x += point[0][0]
y += point[0][1]
return {
'x': x / weight,
'y': y / weight,
'count': weight
}
评论列表
文章目录