I want to change camera resolution using opencv, but it doesn't change

195 Views Asked by At

I set the resolution of the camera capture image using the opencv library.

However, looking at the properties of the saved image, it is different from the resolution I set.

The maximum resolution of the camera is 8mp

import cv2

cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)

cap.set(cv2.CAP_PROP_FRAME_WIDTH, 3264)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 2448)

ret, frame = cap.read()

cv2.imwrite('custom_frame.jpg', frame))

If I do the above, the resolution comes out correctly, but a black image is saved

import cv2

cap = cv2.VideoCapture(0)

cap.set(cv2.CAP_PROP_FRAME_WIDTH, 3264)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 2448)

ret, frame = cap.read()

cv2.imwrite('custom_frame.jpg', frame))

If I do the above, the image comes out properly, but the resolution is saved as 2592x1944

0

There are 0 best solutions below