I'm using opencv 3.2.0 and python 3.5.2 currently. When executing following code:
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)))
I encountered following error:
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'
Could anyone tell me what I should do?
In OpenCV 3.2, drop the CV
in front of the flag.
This should work just fine
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)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With