有没有办法在OpenCV Python中增加网络摄像头的网络摄像头分辨率。默认值是640x480,但我希望它是1365x730。这是我的代码:
import cv2
cap = cv2.VideoCapture(0)
while(1):
_, frame = cap.read()
cv2.imshow('frame', frame)
key = cv2.waitKey(1)
if key == 27:
break
cap.release()
cv2.destroyAllWindows()
答案 0 :(得分:0)
import cv2
cap = cv2.VideoCapture(0)
cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
while(1):
_, frame = cap.read()
cv2.imshow('frame', frame)
key = cv2.waitKey(1)
if key == 27:
break
cap.release()
cv2.destroyAllWindows()