Opencv-Python cv2.CV_CAP_PROP_FPS错误

gas*_*oon 13 python opencv

我目前正在使用opencv 3.2.0和python 3.5.2.执行以下代码时:

videoCapture = cv2.VideoCapture(file_path)
fps = videoCapture.get(cv2.CV_CAP_PROP_FPS)
size = (int(videoCapture.get(cv2.CV_CAP_PROP_FRAME_WIDTH)),
        int(videoCapture.get(cv2.CV_CAP_PROP_FRAME_HEIGHT)))
Run Code Online (Sandbox Code Playgroud)

我遇到以下错误:

Traceback (most recent call last):
  File "videoEditor.py", line 29, in <module>
    fps = videoCapture.get(cv2.CV_CAP_PROP_FPS)
AttributeError: module 'cv2.cv2' has no attribute 'CV_CAP_PROP_FPS'
Run Code Online (Sandbox Code Playgroud)

谁能告诉我应该怎么做?

esh*_*ima 24

在OpenCV 3.2中,放下CV标志前面.这应该工作得很好

videoCapture = cv2.VideoCapture(file_path)
fps = videoCapture.get(cv2.CAP_PROP_FPS)
size = (int(videoCapture.get(cv2.CAP_PROP_FRAME_WIDTH)),
        int(videoCapture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
Run Code Online (Sandbox Code Playgroud)