Ask Your Question

Revision history [back]

Can't get the resolution I want with opencv

import cv2
import numpy as np
cap = cv2.VideoCapture(0)
cap.set(3,1920)
cap.set(4,1080)

while(1):
    _,frame = cap.read()
    cv2.imshow("capture", frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        cv2.imwrite("save.jpg", frame)
        break
cap.release()
cv2.destroyAllWindows()

When I set the resolution to 19201080, I get the save.jpg with 19201080. But I get save .jpg with 1280720 when I set the resolution to 12801024. Is it because the videocapture device just support some fixed resolution or the opencv?