Display sequence of images using matplotlib
matplotlib, opencv, python
Solution
img = None
for f in files:
im=pl.imread(f)
if img is None:
img = pl.imshow(im)
else:
img.set_data(im)
pl.pause(.1)
pl.draw()
Problem
I have this simple python script using OpenCV to load images from a folder and display them in a loop. I want to reproduce this effect using `matplotlib`. ``` import cv2 as cv import os im_files = [for f in os.listdir('.') if f[-3:] == 'png'] for f in im_files: im = cv.imread(f, 0) #read image in greyscale cv.imshow('display', im) cv.waitKey(1) cv.destroyAllWindows() ``` I tried the following script but the pyplot window which opens to display the plots becomes un responsive. ``` import pylab as pl import os files = [f for f in os.listdir('.') if f[-3:] == 'png'] pl.ion() for f in files: im=pl.imread(f) pl.imshow(im) pl.draw() ``` I have googled a lot but couldn't find any solution. How do I go about doing this? I am using Anaconda 1.6 32bit on Windows 8.