,以便从帧中检测人脸
video_capture = cv2.VideoCapture(0)
while True:
# 从视频中捕获最新的帧
check, frame = video_capture.read...# 将帧转换为灰度(黑白阴影)
gray_image = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
face = cascade.detectMultiScale(...for x, y, w, h in face:
# 在检测到的人脸周围绘制边框
# (此处边框颜色为绿色,粗细为3)
image = cv2.rectangle(frame, (x, y),...check, frame = video_capture.read()
# 将帧转换为灰度(黑白阴影)
gray_image = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY...#(这里边框颜色为绿色,粗细为3)
image = cv2.rectangle(frame, (x, y), (x+w, y+h),
(0, 255, 0), 3)
# 模糊矩形中的人脸