generate_cascade_training_data.py 文件源码

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

项目:ObjectDetection 作者: PhilippParis 项目源码 文件源码
def create_cascade_neg_data():
    img = cv2.imread(FLAGS.negatives_spritesheet)
    img = cv2.normalize(img, None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8U)
    height, width, _ = img.shape

    c = 0
    txt = ""
    for y in xrange(0, height, FLAGS.image_size):
        for x in xrange(0, width, FLAGS.image_size):
            cv2.imwrite(FLAGS.output_dir + "/negatives/" + str(c) + ".png", img[y:y+FLAGS.image_size, x:x+FLAGS.image_size])
            txt += "negatives/" + str(c) + ".png" + "\n"
            c += 1

    with open(FLAGS.output_dir + "/negatives.info", 'w') as file:
        file.write(txt)        

    return c

# ========================================== #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号