我想在OpenCV Python中提高我的网络摄像头的分辨率

时间:2018-05-24 12:15:13

标签: python opencv

有没有办法在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()

1 个答案:

答案 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()