问题
I'm trying to take 4k pictures using OpenCV, but when I change the resolution, the pictures just look resized instead of better quality.
I'm using OpenCV version 4, Python 3.6, Logitech BRIO 4k webcam and Windows 10.
If I don't change the camera resolution, it defaults to 640 x 480. If I change the resolution, the pictures just look blurred like they have been resized and not actually better quality. I can use the "Camera" app on Windows 10 to verify that the camera works with 4k resolution.
Here's what I'm doing:
import cv2
cam = cv2.VideoCapture(0)
cam.set(3, 3840)
cam.set(4, 2160)
cv2.namedWindow("test")
while True:
ret, frame = cam.read()
cv2.imshow("test", frame)
if not ret:
break
k = cv2.waitKey(1)
if k%256 == 32:
# SPACE pressed
img_name = "opencv_frame.png"
cv2.imwrite(img_name, frame)
print("{} written!".format(img_name))
I'd like to be able to change the actual resolution of the pictures.
来源:https://stackoverflow.com/questions/55690750/change-real-camera-resolution-in-opencv