Skip to content

Commit

Permalink
TODO imageio
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Mar 28, 2018
1 parent ec426be commit b1621eb
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions cvphantom/plots.py
@@ -1,11 +1,8 @@
from scipy.misc import bytescale, imsave
from matplotlib.pyplot import figure,draw, pause
#
try:
from pyimagevideo.writeavi_opencv import videoWriter
except ImportError:
videoWriter=None

import imageio # TODO use for video writing
VideoWriter=None

def playwrite(imgs,U):
assert imgs.ndim==3
Expand All @@ -16,10 +13,10 @@ def playwrite(imgs,U):
hi = ax.imshow(imgs[0,...], origin='bottom', interpolation="none")
fg.colorbar(hi,ax=ax)

if U['fmt'] == 'avi' and videoWriter is not None: #output video requested
if U['fmt'] == 'avi' and VideoWriter is not None: #output video requested
ofn = f"{U['texture']}_{U['motion']}.avi"
print('writing', ofn)
hv = videoWriter(ofn,'FFV1',imgs.shape[:2][::-1],usecolor=False)
hv = VideoWriter(ofn,'FFV1',imgs.shape[:2][::-1],usecolor=False)
elif U['fmt'] is not None:
hv = U['fmt']
else:
Expand All @@ -40,7 +37,4 @@ def playwrite(imgs,U):
else:
hv.write(bytescale(imgs[i,...],cmin=0,cmax=imgs.max()))

try:
hv.release()
except AttributeError:
pass

0 comments on commit b1621eb

Please sign in to comment.