I am currently try to adjust the resolution of the video by opencv, according to my research, cap.set is the method to do so. thus, I write the code below:
cap = cv2.VideoCapture('IMG_2957.MOV')
for i in range(19):
print (""+str(i)+" "+str(cap.get(i)))
cap.set(3,160) #Width
cap.set(4,120) #Height
for i in range(19):
print (""+str(i)+" "+str(cap.get(i)))
very surprise, the value of "CV_CAP_PROP_FRAME_WIDTH" and "CV_CAP_PROP_FRAME_HEIGHT" remain unchanged
Before the cv.set
3 1920.0
4 1080.0
And after the setting, the frame was not set as what I want
After the cv.set
3 1920.0
4 1080.0
Is that we are not able to change the resolution by setting its property? Can anyone advice me the usage of .set of cv2.videocapture?
More information about the version:
Python 3.6.0 [MSC v.1900 64 bit (AMD64)] on win32
>>> import cv2
>>> cv2.__version__
'3.4.0'
cv2.resizefor that purpose)