{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ ":0: FutureWarning: IPython widgets are experimental and may change in the future.\n" ] } ], "source": [ "import numpy as np\n", "from scipy.misc import imread\n", "\n", "from bokeh.plotting import figure, show\n", "from bokeh.io import output_notebook\n", "from bokeh.models import ColumnDataSource\n", "from bokeh.palettes import Greys9, Greys3\n", "\n", "from IPython.html.widgets import interact" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ " \n", " \n", " \n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "output_notebook()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [], "source": [ "TOOLS=\"pan, box_zoom, reset, save\"\n", "\n", "# The image is this one: https://windycitizensports.files.wordpress.com/2011/10/baboon.jpg?w=595\n", "RGB_image = imread('/Users/curt/Downloads/BaboonRGB.jpg')\n", "\n", "nx, ny, n_colors = RGB_image.shape\n", "\n", "source = ColumnDataSource(data={'image': RGB_image[:, :, 0]})\n", "\n", "p = figure(title=\"Single-color slice of RGB image\", \n", " tools=TOOLS, \n", " x_range=[0, nx], \n", " y_range=[0, ny],\n", " )" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "