Commit 66a8b95c authored by Romain Casati's avatar Romain Casati
Browse files

Fix: support new API in examples.

parent 020880b2
Pipeline #385333 passed with stages
in 4 minutes and 48 seconds
{"cells":[{"metadata":{"trusted":true},"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def read(filename):\n \"\"\" Read an image from a file into an array. \"\"\"\n return (255 * plt.imread(filename)).astype(int)\n\ndef show(*args):\n \"\"\" Display numpy arrays as images. \"\"\"\n for img in args:\n basthon.display_image(img)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"snake = read(\"snake.png\")\nshow(snake)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from scipy.ndimage.filters import gaussian_filter\n\n# see https://en.wikipedia.org/wiki/Unsharp_masking\nblurred = gaussian_filter(snake, sigma=2)\nsharp = np.clip(snake + (snake - blurred), 0, 255)\n\nshow(snake, sharp)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from scipy.ndimage.filters import sobel\n\nshow(snake, sobel(snake))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from scipy.ndimage.filters import median_filter\n\nshow(snake, median_filter(snake, 7))","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"}},"nbformat":4,"nbformat_minor":2}
\ No newline at end of file
{"cells":[{"metadata":{"trusted":true},"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt\nfrom IPython.display import display_image","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def read(filename):\n \"\"\" Read an image from a file into an array. \"\"\"\n return (255 * plt.imread(filename)).astype(int)\n\ndef show(*args):\n \"\"\" Display numpy arrays as images. \"\"\"\n for img in args:\n display_image(img)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"snake = read(\"snake.png\")\nshow(snake)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from scipy.ndimage.filters import gaussian_filter\n\n# see https://en.wikipedia.org/wiki/Unsharp_masking\nblurred = gaussian_filter(snake, sigma=2)\nsharp = np.clip(snake + (snake - blurred), 0, 255)\n\nshow(snake, sharp)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from scipy.ndimage.filters import sobel\n\nshow(snake, sobel(snake))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from scipy.ndimage.filters import median_filter\n\nshow(snake, median_filter(snake, 7))","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"}},"nbformat":4,"nbformat_minor":2}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment