由于license的原因,无法读取GIF:http://answers.opencv.org/question/185929/how-to-read-gif-in-python/
但是可以用其他库(PIL,Imageio)读取,保存为PNG,JPG的图片,然后opencv就能读取了
https://stackoverflow.com/questions/18502508/is-there-a-way-to-read-a-truncated-gif-with-pil
import cv2
from PIL import Image
gif = cv2.VideoCapture('file.gif')
ret,frame = gif.read() # ret=True if it finds a frame else False. Since your gif contains only one frame, the next read() will give you ret=False
img = Image.fromarray(frame)
img = img.convert('RGB')