赞
踩
各位大佬:
1.我是在centos6.9系统编译的python3.6.3版本,地址是/usr/local/python3,然后使用bin文件下的pip3安装了opencv_python库
2.在/usr/local/python3/lib/python3.6/site-packages/下生成opencv_python-3.3.0.10.dist-info和cv2目录
3.然后使用命令运行/usr/local目录下的snapshot.py脚本文件,即:/usr/local/python3/bin/python3 snapshot.py 提示错误:
OpenCV Error: Unknown error code -10 (Raw image encoder error: Empty JPEG image (DNL not supported)) in throwOnEror, file /io/opencv/modules/imgcodecs/src/grfmt_base.cpp, line 140
Traceback (most recent call last):
File "snapshot.py", line 21, in
main()
File "snapshot.py", line 11, in main
ret,arr = cv2.imencode('.jpg', frame)
cv2.error: /io/opencv/modules/imgcodecs/src/grfmt_base.cpp:140: error: (-10) Raw image encoder error: Empty JPEG image (DNL not supported) in function throwOnEror
请教大佬是什么原因,在windows下是可以按照程序截取到帧图片
import cv2
import numpy as np
from sys import argv
import base64
def main():
cap = cv2.VideoCapture("rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov")
for i in range(1, 500):
ret,frame = cap.read()
ret,arr = cv2.imencode('.jpg', frame)
a = arr.tostring()
fp = open('test'+str(i)+'.jpg', 'wb')
fp.write(a)
fp.close()
fps = cap.get(5)
print(fps)
cap.release()
if __name__ == '__main__':
main()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。