pupil_detect.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:OpenCV-Bright-Spots-Eye-Detection 作者: bodhwani 项目源码 文件源码
def find_pupil(gray_image, minsize=.1, maxsize=.5):
    detector = cv2.FeatureDetector_create('MSER')
    features_all = detector.detect(gray_image)
    features_big = [feature for feature in features_all if feature.size > gray_image.shape[0]*minsize]
    features_small = [feature for feature in features_big if feature.size < gray_image.shape[0]*maxsize]
    if len(features_small) == 0:
        return None
    features_sorted = sort_features_by_brightness(gray_image, features_small)
    pupil = features_sorted[0]
    return (int(pupil.pt[0]), int(pupil.pt[1]), int(pupil.size/2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号