Question: Write a function that saves the image as a specified file: ( 1 5 % ) - In the parameter lists, it supplies an

Write a function that saves the image as a specified file: (15\%)
- In the parameter lists, it supplies an image filename and output filename
- Load the image and convert it to the grayscale
- Blur the image
- Run the Sobel edge detection algorithm on the blurred image, with applying both vertical and horizontal filters.
- Run the Canny edge detection algorithm on the blurred image
- Stack the three images in a column
- Save the result as the specified output filename. Do not show the plots.
This problem is about image processing and data visualization.
Note: There are multiple ways in stacking images. You may consider plt . subplot, or cv2.vconcat.
Code:
```
#
import numpy as np
import cv2
import matplotlib.pyplot as plt
# Problem 2
def problem_2(image_filename, output="q2.jpg"):
# write your logic here
plt.savefig(output) # do not show the plt
```
 Write a function that saves the image as a specified file:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!