# Math 151 Lab 07 - 02/07/2018:

DUE: Wednesday, February 12, 2018 (by 4:00pm before class starts)

INSTRUCTIONS:

Save this Matlab script with the filename LastName_Lab07.m (example: Lewis_Lab07.m). Complete each question (either in words or with Matlab code). When you are ready to have your assignment graded, choose the PUBLISH command from the file menu, and submit the resulting file to CANVAS.

## #1

WRITE CODE BELOW:

Note: For all images use colormap(gray)

a) Load the image coffee.jpg into matrix A and view it with imagesc.

b) Load the image grays_torreys.png into matrix B and modify it from an RGB image to an image with only 1-dimension of color (use the grayscale formula), then view it with imagesc in a new figure.

c) Load the image boston_common.png into matrix C and modify it so that it has 1 dimension of color and plot it in another new figure.

d) Load the image bike.jpg into matrix D, but do not modify it. Plot it in a new figure.

------------------------------------------------------------------------

## #2

WRITE CODE BELOW:

a) Using matrix B from problem 1, apply the DY sobel mask to it and view what the edges look like.

b) Using matrix D from problem 1, apply the DX sobel mask to it and view what the edges look like.

WRITE A COMMENT BELOW:

Can you see the edges where the mountains meet the sky in part a? They should show up as dark streaks in your image. What can you see in part b?

------------------------------------------------------------------------

## #3

WRITE CODE BELOW:

Step 1: Using matrix C from problem 1, apply all 3 masks to it and then use the subplot command to make a 2x2 plot of these images (You may need to look at the lecture where we used the subplot command).

Step 2: Plot the gradient intensity in a separate figure.

Step 3: Make sure to title each plot and subplot with the mask that was applied to it (use an appropriate title).

------------------------------------------------------------------------

## #4

WRITE CODE BELOW:

Write a function to create a contrasted image of matrix A from problem 1. Display the contrasted image using a tolerance of 100 and then 150 in two separate figures.

------------------------------------------------------------------------