调整cv2.VideoCapture的框架大小

时间:2019-11-16 02:38:09

标签: python numpy machine-learning computer-vision cv2

我正在尝试将原始(480,640,3)中的帧图像阵列调整为(224,224,3),但是我使用了 CV_CAP_PROP_FRAME_WIDTH,CV_CAP_PROP_FRAME_HEIGHT,仅更改屏幕在屏幕上显示的大小。 我的代码在这里!

# Original path - wouldn't work
path = "c:\location\directory"

# Raw string - would work
path = r"c:\location\directory"

# Double slashes - would work
path = "c:\\location\\directory"

# Forward slashes - would work
path = "c:/location/directory"

1 个答案:

答案 0 :(得分:0)

您可以在while循环中添加以下代码,

frame = cv2.resize(frame,(224,224))

print(frame.shape)