在python上,当我尝试使用打开的cv2进行视频捕获时,我得到的结果是:
2021-11-18 11:07:36.572 Python[5863:20765] =>> Checked Property: [cfen] 1667655022
2021-11-18 11:07:36.572 Python[5863:20765] =>> Checked Property: [cfen] 1667655022
2021-11-18 11:07:36.572 Python[5863:20765] =>> Checked Property: [cfen] 1667655022
2021-11-18 11:07:36.572 Python[5863:20765] =>> Checked Property: [cfac] 1667653987
2021-11-18 11:07:36.621 Python[5863:20765] =>> Checked Property: [cfen] 1667655022
2021-11-18 11:07:36.622 Python[5863:20765] =>> Checked Property: [cfen] 1667655022
2021-11-18 11:07:36.722 Python[5863:20765] =>> Checked Property: [cfen] 1667655022
2021-11-18 11:07:36.722 Python[5863:20765] =>> Checked Property: [cfen] 1667655022我还打开了这个窗口:
这是我的代码:
import cv2
trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
webcam = cv2.VideoCapture(0)
ret, frame = webcam.read()
grayscaled_img = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('image face detector', grayscaled_img)
cv2.waitKey(1)发布于 2021-11-18 11:41:19
只需将参数cv2.VideoCapture(0)更改为cv2.VideoCapture(2)即可解决
希望能对其他Mac用户有所帮助
https://stackoverflow.com/questions/70018024
复制相似问题