facerec_train.py 文件源码

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

项目:deepvisualminer 作者: pathbreak 项目源码 文件源码
def detect(img_file, detector_xml_path, dest_img_file):
    img = cv2.imread(img_file)

    gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    detector = cv2.CascadeClassifier(detector_xml_path)

    min_size = (min(50, gray_img.shape[0] // 10), min(50, gray_img.shape[1] // 10))
    hits = detector.detectMultiScale(gray_img, 1.1, 4, 0, min_size)
    #cv2.groupRectangles(hits, 2)
    print(hits)

    hits_img = np.copy(img)
    for (x,y,w,h) in hits:
        cv2.rectangle(hits_img, (x,y), (x+w, y+h), (0,0,255), 2)
    cv2.imwrite(dest_img_file, hits_img)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号