def nb_imshow(image, cmap='jet'):
'''
Interactive equivalent of imshow for ipython notebook
'''
colormap = cm.get_cmap(cmap) # choose any matplotlib colormap here
grayp = [mpl.colors.rgb2hex(m) for m in colormap(np.arange(colormap.N))]
xr = Range1d(start=0, end=image.shape[1])
yr = Range1d(start=image.shape[0], end=0)
p = bpl.figure(x_range=xr, y_range=yr)
# p = bpl.figure(x_range=[0,image.shape[1]], y_range=[0,image.shape[0]])
# p.image(image=[image], x=0, y=0, dw=image.shape[1], dh=image.shape[0], palette=grayp)
p.image(image=[image[::-1, :]], x=0, y=image.shape[0],
dw=image.shape[1], dh=image.shape[0], palette=grayp)
return p
评论列表
文章目录