i tried capture 8mp image in opencv.
but saved image’s resolution is always (1944, 2592) ← 5mp
How to capture 8mp image?
i tried below
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()
print(frame.shape)
if ret:
cv2.imwrite('./frame.jpg', frame)
berak
2
please check the return value (it’s probably not supported)
(also, if i may ask, what on earth do you want with 8mp in computer-vision ?)
frame.shape returned (1944, 2592)
I have to use high resolution camera images to find very small objects.
When I actually tried it, 5mp is ambiguous and it starts to look good from 8mp
does the camera sensor even have 8 MP?
the full resolution may not be supported in video modes but only in still modes.
cameras distinguish between those, although it’s a purely arbitrary distinction. still modes have no expectation of “decent frame rate”.
It was confirmed that the camera in the windows environment can shoot at 8mp and the image of 8mp resolution is saved…
Are you saying i should use a function to capture in still mode, not a videocapture function?
berak
6
you’re probably using the MSMF backend (default) on windows, try if the directshow one works better for you:
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
I’ve already tried it, but when I do that, the size of the image comes out correctly, but a black image is saved.
I don’t know why, but it was solved by using CAP_DSHOW and setting the focus and brightness.
Thank you!