face_detect.py 文件源码

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

项目:OpenCV_FaceDetect 作者: csuldw 项目源码 文件源码
def detectByClf(image_name, clf):
    img = cv2.imread(image_name)
    smiles_cascade = cv2.CascadeClassifier(clf)
    #??img???3???????????????gray?????3??2????????
    if img.ndim == 3:
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    else:
        gray = img 

    print "start detecting..."    
    zones = smiles_cascade.detectMultiScale(gray, 1.3, 5)
    result = []
    for (x, y, width, height) in zones:
        result.append((x, y, x+width, y+height))
    print "end detecting."    
    return result


#??????????outpath???
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号