top of page

# Summary

### Checkpoint

Click on the Edit in Repl.it button in the upper right corner of the terminal below. This will take you to the repl.it website, where you can create a free account (recommended, if you haven't already). Then, you can write, run, and save your own code to answer the questions below (also provided as comments on the repl.it site):

You will be applying what you've learned to this image of holiday cookies.

1. Right-click and save the image as "cookies.jpg" and upload it to Repl.it.

2. Find the dimensions (shape) of the image using NumPy

3. Use array slicing to select just the part of the image that shows the snowman cookie

4. Use NumPy to identify where the maximum and minimum values of the image occur. What kind of features do they correspond to?

# Now it's your turn! Write in your solutions below the appropriate comment

# Click the run button at the top to check your answers

# Solutions will be provided when you complete the entire lesson

# Reminder: In order to see any output, commands must be wrapped in print() statements (e.g. "print(1 + 2)" will print 3 to the dark console while "1 + 2" will not have any output)

#import necessary packages

import numpy as np

import matplotlib.pyplot as plt

from skimage import io

#read in image

10 imagefile = io.imread('cookies.jpg', as_gray = True)

11

12 #Show the image using matplotlib

13

14 #Find the shape of the image using NumPy

15

16 #Use array slicing to select the part of the image that shows the snowman cookie, and check that your answer is correct by plotting with Matplotlib

17

18 #use NumPy to identify where the maximum and minimum values of the image occur. 19 What kind of features do they correspond to?

bottom of page