python 美颜人脸
【摘要】
value越大,美颜效果越好,时间越长
10就够了,有明显效果, 15的时候,18ms
# coding:utf-8import timeimport numpy as npimport cv2 if __name__ == '__main__': value = 15 capture = cv2.VideoCapture(0) whi...
value越大,美颜效果越好,时间越长
10就够了,有明显效果, 15的时候,18ms
-
# coding:utf-8
-
import time
-
import numpy as np
-
import cv2
-
-
if __name__ == '__main__':
-
-
value = 15
-
capture = cv2.VideoCapture(0)
-
-
while True:
-
-
ret, frame = capture.read()
-
frame = cv2.flip(frame, 1, dst=None) # 水平镜像
-
roi=frame[50:350,250:450]
-
start=time.time()
-
image_dst = cv2.bilateralFilter(roi, value, value * 2, value / 2)
-
print('time',value, time.time() - start)
-
-
frame[50:350,250:450]=image_dst
-
cv2.imshow('frame', frame)
-
-
c = cv2.waitKey(30)
-
if 27 == c: # Esc quit
-
break;
-
elif c == ord('w'):
-
value += 1
-
elif c == ord('s'):
-
value -= 1
-
-
capture.release()
-
-
cv2.destroyAllWindows()
-
-
# dst = cv2.bilateralFilter(src=image, d=0, sigmaColor=100, sigmaSpace=5)
发现第一次慢,后面就快了
time 0.2943227291107178
time 0.008997201919555664
time 0.010003328323364258
time 0.009996414184570312
time 0.011000633239746094
time 0.010999917984008789
time 0.010999917984008789
time 0.009999275207519531
time 0.011000633239746094
time 0.01100015640258789
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/84930484
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)