import time, cv2 from PIL import Image import numpy as np
defGIF(file): List = [] im = Image.open(file) im.seek(1)#skip to the second frame try: while1: List += [cv2.cvtColor(np.asarray(im.convert()),cv2.COLOR_RGB2BGR)] im.seek(im.tell()+1) except EOFError:#the sequence ends pass Num = 0 while Num < len(List)*2: Num +=1 ID = Num%(len(List)) cv2.imshow("OpenCV",List[ID]) print(ID) cv2.waitKey(1) time.sleep(0.1) cv2.destroyAllWindows()
for Videos:
from cv2 import cv2 import imageio import numpy # Collection of the imgs frames_list = []
# Tossed frames per FPS. When FPS = 1, all frame are saved. FPS = 1