Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-01, 22:40   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 我想从opencv-python中所有检测到的面孔中选择特定的面孔

我使用过haarcascade_frontalface_default.xml来检测图像中的所有面孔。以下是代码

import cv2 cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') def find_and_blur(bw, color): # detect al faces faces = cascade.detectMultiScale(bw, 1.1, 4) # get the locations of the faces for (x, y, w, h) in faces: # select the areas where the face was found roi_color = color[y:y+h, x:x+w] # blur the colored image blur = cv2.GaussianBlur(roi_color, (101,101), 0) # Insert ROI back into image color[y:y+h, x:x+w] = blur # return the blurred image return color # turn camera on video_capture = cv2.VideoCapture(0) while True: # get last recorded frame _, color = video_capture.read() # transform color -> grayscale bw = cv2.cvtColor(color, cv2.COLOR_BGR2GRAY) # detect the face and blur it blur = find_and_blur(bw, color) # display output cv2.imshow('Video', blur) # break if q is pressed if cv2.waitKey(1) & 0xFF == ord('q'): break # turn camera off video_capture.release() # close camera window cv2.destroyAllWindows()



现在,我想从所有检测到的面孔中选择特定的面孔,以在该选择的面孔上进行将来的操作,例如跟踪。例如。 我想选择小女孩的脸来追踪它

请帮助,并提前谢谢。



更多&回答...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 23:32


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.