extract_hog_features.py 文件源码

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

项目:CS231A_Project 作者: afazel 项目源码 文件源码
def extract_pos_hog_features(path, num_samples):

    features = []
    cnt = 0
    for dirpath, dirnames, filenames in walk(path):
        for my_file in filenames:
            print path+my_file
            if cnt < num_samples:
                cnt = cnt + 1
                im = cv2.imread(path + my_file)
                print im.shape
                image = color.rgb2gray(im)
                image = image[17:145, 16:80]

                my_feature, _ = hog(image, orientations=9, pixels_per_cell=(8, 8),cells_per_block=(2, 2), visualise=True)
                features.append(my_feature)
    return features
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号