{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from matplotlib import pyplot as plt\n", "import numpy as np\n", "from scipy import ndimage as ndi\n", "import imageio\n", "%matplotlib notebook" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Load an image from twitter. Photo by Lucio Ilian." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# This computes the mean of the three color channels\n", "a = (imageio.imread('https://pbs.twimg.com/media/EktI9wKXYAE6GKQ?format=jpg&name=large')/255.).mean(axis=-1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure()\n", "plt.imshow(a, cmap='gray')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Select Region of interest" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "roi = a[100:600, 800:1300]\n", "plt.figure()\n", "plt.imshow(roi, cmap='gray')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 4 }