19
19
OcropusException )
20
20
from numpy import (amax , amin , array , bitwise_and , clip , dtype , mean , minimum ,
21
21
nan , sin , sqrt , zeros , unique , fromstring )
22
- from pylab import (clf , cm , ginput , gray , imshow , ion , subplot ,
23
- where , xticks , yticks , title , xlabel , ylabel )
24
22
from scipy .ndimage import morphology , measurements
25
23
import PIL
26
24
@@ -802,6 +800,7 @@ def binarize_range(image,dtype='B',threshold=0.5):
802
800
803
801
def plotgrid (data ,d = 10 ,shape = (30 ,30 )):
804
802
"""Plot a list of images on a grid."""
803
+ from matplotlib .pyplot import ion , gray , clf , subplot , imshow , ginput
805
804
ion ()
806
805
gray ()
807
806
clf ()
@@ -813,11 +812,13 @@ def plotgrid(data,d=10,shape=(30,30)):
813
812
ginput (1 ,timeout = 0.1 )
814
813
815
814
def showrgb (r ,g = None ,b = None ):
815
+ from matplotlib .pyplot import imshow
816
816
if g is None : g = r
817
817
if b is None : b = r
818
818
imshow (array ([r ,g ,b ]).transpose ([1 ,2 ,0 ]))
819
819
820
820
def showgrid (l ,cols = None ,n = 400 ,titles = None ,xlabels = None ,ylabels = None ,** kw ):
821
+ from matplotlib .pyplot import cm , xticks , yticks , subplot , imshow , title , xlabel , ylabel
821
822
if "cmap" not in kw : kw ["cmap" ] = cm .gray
822
823
if "interpolation" not in kw : kw ["interpolation" ] = "nearest"
823
824
n = minimum (n ,len (l ))
0 commit comments