Unable to set video capture size
I'm attempting to set my laptop webcam video capture size to 800 x 600 using:
import cv2
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 800)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 600)
while 1:
ret, frame = cap.read()
width = video_capture.get(cv2.CAP_PROP_FRAME_WIDTH)
height = video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT)
print('size:', width, height)
but when this runs, it displays:
size: 640.0 480.0
Why is it capturing at a smaller resolution? Does my webcam only support a maximum of 640x480 resolution or am I mis-using cv2?
I'm running Ubuntu 16, and if I use the program Cheese to test my webcam, it reports a maximum video resolution of 1280 x 720.
when resolution is not available nothing is changed or the nearest resolution is set. try to to 1280X720. Use a third party software to get all resolutions available on your webcam