码迷,mamicode.com
首页 > 其他好文 > 详细

OpenCV--圣诞帽

时间:2017-12-24 18:55:09      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:bsp   width   span   没有   tps   add   print   git   这一   

 

#https://github.com/LiuXiaolong19920720/Add-Christmas-Hat

代码可以跑通

但有两个问题:

1.add_hat(img,hat_img)

该函数如果没有检测到人脸是没有返回值的,导致函数的鲁棒性较弱,甚至后续程序崩溃

2.

    # dlib正脸检测器
    detector = dlib.get_frontal_face_detector()

    # 正脸检测
    dets = detector(img, 1)

实际上,检测能力较弱,如果人脸有点倾斜可能就检测不到了。

sz1 = img_ori.shape[0]
sz2 = img_ori.shape[1]
print(width: %d \nheight: %d %(sz1,sz2))
img_cur = cv2.resize(img,(sz2,sz1)) 

sz1 = img_cur.shape[0]
sz2 = img_cur.shape[1]
print(width: %d \nheight: %d %(sz1,sz2))
img_cur = cv2.resize(img,(sz2,sz1)) 这一行比较特殊,先是高度再是宽度

 

OpenCV--圣诞帽

标签:bsp   width   span   没有   tps   add   print   git   这一   

原文地址:http://www.cnblogs.com/kprac/p/8098702.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!