我正在尝试将原始 (480,640,3) 中的帧图像数组大小调整为 (224,224,3),但我使用 CV_CAP_PROP_FRAME_WIDTH、CV_CAP_PROP_FRAME_HEIGHT,仅更改屏幕上显示的框架的大小。非常感谢! 我的代码在这里!
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
frame = cv2.flip(frame, 1)
# Display the resulting frame
cv2.imshow('frame',frame)
print(frame.shape)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
最佳答案
您可以在 while 循环中添加以下代码,
frame = cv2.resize(frame, (224, 224))
打印(框架.形状)
关于python - 调整 cv2.VideoCapture 的帧大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58887056/