Homework 11
Navigate to https://colab.research.google.com/drive/1jvNv59LNDx1XUmpk-hclIthMGrnuuOfl for a starter file for HW 11.
1. Load the image from http://r0k.us/graphics/kodak/kodak/kodim05.png (already done in the starter file if you’re using Google Colab). Otherwise, you may need to download it to your working directory and call it “bikes.png”. Display the following:
a) A rotation of the image by 15◦ counterclockwise.
b) A rotation of the image by 15◦ clockwise.
c) Scale the horizontal dimension only by a factor of 0.5.
d) Display a blurred version of the original image. Make sure you adjust sigma so that you can actually see a noticeable blur!
2. We will use another image with a blue screen background to do a similar operation as we did in class on Tuesday 11/18. We want to extract the figure from the blue screen and then place it on the beach background. The result is as shown (Left: Blue screen image, Middle: Beach picture, Right: combining the images). The direct links to the left and middle images are in the Colab starter file.
3. A noisy image of a cat has been put in the starter file. You can also get this image from the skimage.data library. Use the TV-Chambolle method to denoise the image and show the noisy image as well as the denoised image.
1
4. Create a simple checkerboard image in the following way. Let img = np.zeros((8, 8)). This will be the variable that stores our image. Starting on the first row, we should have a pattern of white, black, white, black, etc. On the next row, we should alternate the other way, so that we have black, white, black, white, etc. Keep going until you get to the end. In the end, we should see something like this:
One easy way to do this is using a nested for loop. You can let i and j each go from 0 up to 7. Then if (i + j) is even, set that element to 1 (img[i, j] = 1). You don’t need to do anything with the odd elements since those were already 0. Display this image using plt.imshow(img, cmap = ”gray”).