Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 调整cv2.VideoCapture的帧大小_Python_Numpy_Machine Learning_Computer Vision_Cv2 - Fatal编程技术网

Python 调整cv2.VideoCapture的帧大小

Python 调整cv2.VideoCapture的帧大小,python,numpy,machine-learning,computer-vision,cv2,Python,Numpy,Machine Learning,Computer Vision,Cv2,我试图将原始(480640,3)中的帧图像数组调整为(224224,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()

我试图将原始(480640,3)中的帧图像数组调整为(224224,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。调整大小(frame,(224224,224))


打印(框架.形状)

但是。。。您实际在哪里调整框架的大小?oO您不想添加类似于
frame=imutils.resize(frame,width=500)
的内容吗?谢谢您的帮助,它成功了,我感到非常高兴,这是我第一次在这个网站上提问。谢谢您的回复,我很高兴能够提供帮助。