top of page

Image Processing

Image Files

Searching Images

Checkpoint

Thresholding

Edge Detection

Template Matching

Summary

Summary

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):

 

 

Using the cookie image above (right-click and save as "cookies.jpg"), you will identify where the palm tree cookie template below (right-click and save as "cookietemplate.jpg") best matches the image.

cookies.jpg
cookietemplate.jpg

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

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

3  # Solutions will be provided when you complete the entire 4 lesson

4  # 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)

5  #import necessary packages

6  import numpy as np

7  import matplotlib.pyplot as plt

8  from skimage import io

9  from skimage.feature import match_template

10 #read in image

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

12

13 #read in template image

14 template = io.imread('cookietemplate.jpg', as_gray = True)

15

16 #Identify the location in the cookie image where the template 3 best matches

bottom of page