调整 cv2.VideoCapture 的框架大小
Resize frame of cv2.VideoCapture
我正在尝试将原始 (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 循环中添加以下代码,
帧 = cv2.resize(帧, (224, 224))
打印(frame.shape)
我正在尝试将原始 (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 循环中添加以下代码,
帧 = cv2.resize(帧, (224, 224))
打印(frame.shape)