解决方法——AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
2016-12-26 11:03
2306 查看
今天遇到的AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
错误出现的原因是你安装的版本和你使用的语句可能不对应。
后来经过查询得知:cv2.VideoWriter_fourcc()是opencv3.0所用,而cv2.cv.CV_FOURCC()用于opencv2.4.*
cv2.VideoWriter_fourcc is for opencv3.0. with opencv2.4, use cv2.cv.CV_FOURCC()
but try 'M','J','P','G' or some other combination for the codec
let's make it a bit clearer:
3.0 version:
2.4 version:
berak (Jan
2 '15)
上方答案出自——AttributeError: 'module' object has no attribute 'VideoWriter_fourcc' - OpenCV Q&A Forum http://answers.opencv.org/question/29648/attributeerror-module-object-has-no-attribute-videowriter_fourcc/
错误出现的原因是你安装的版本和你使用的语句可能不对应。
后来经过查询得知:cv2.VideoWriter_fourcc()是opencv3.0所用,而cv2.cv.CV_FOURCC()用于opencv2.4.*
cv2.VideoWriter_fourcc is for opencv3.0. with opencv2.4, use cv2.cv.CV_FOURCC()
but try 'M','J','P','G' or some other combination for the codec
let's make it a bit clearer:
3.0 version:
out = cv2.VideoWriter('output.avi',cv2.VideoWriter_fourcc(*'XVID'), 20.0, (640,480))
2.4 version:
out = cv2.VideoWriter('output.avi',cv2.cv.CV_FOURCC('M','J','P','G'), 20.0, (640,480))
berak (Jan
2 '15)
上方答案出自——AttributeError: 'module' object has no attribute 'VideoWriter_fourcc' - OpenCV Q&A Forum http://answers.opencv.org/question/29648/attributeerror-module-object-has-no-attribute-videowriter_fourcc/
相关文章推荐
- Keras深度学习框架学习笔记(3) - AttributeError:’module’ object has no attribute ‘ifelse’错误信息的解决方法
- Python2.7 安装mock出现AttributeError: 'module' object has no attribute的解决方法
- AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
- AttributeError: 'module' object has no attribute 的解决方法
- AttributeError: 'module' object has no attribute 的解决方法
- AttributeError: 'module' object has no attribute 的解决方法
- AttributeError: 'module' object has no attribute 'Frame' 解决方法
- Scrapy AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1 解决方法
- AttributeError: 'module' object has no attribute '_handlerList' 错误解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- yum错误'module' object has no attribute 'iterparse'解决方法
- python AttributeError: 'module' object has no attribute 'dumps'解决办法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Ubuntu运行scrapy报“scrapy: 'module' object has no attribute 'OP_SINGLE_ECDH_USE'错误解决方法”
- AttributeError: 'module' object has no attribute 'face' 问题解决 opencv+python
- AttributeError: 'module' object has no attribute 'Frame' 解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- AttributeError: 'module' object has no attribute 的解决方法
- 【python学习笔记(2)】脚本报错"AttributeError: 'module' object has no attribute 'xxx'"解决方法