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

Write a function that saves the image as a specified file. (15\%)
- In the parameter list, it supplies two image filenames, k, ratio and output filename
- Suppose the first image is the query, the second image is the scene
- Load the images and convert them to grayscale
- Run SIFT detectors on both grayscale images
- Use knnMatch with the value of \( k \) to compare the SIFT descriptors
- Use a ratio test with the value of ratio to identify the common descriptors
- Use drawMatchesKnn to draw the list of matches onto the images
- Stack the two images horizontally
- Save the plots as the specified output filename. Do not show the plots.
This problem is about image processing and data visualization.
Note: You may refer to cv2.BFMatcher():
Code:
```
# Problem 3
def problem_3(imageA, imageB, output="q3.jpg"):
# write your logic here
plt.savefig(output) # do not show the plt
```
Execution:
```
> imageA = "image3a.jpg"
> imageB = "image3b.jpg"
> problem_3(imageA, imageB, "q3.png")
```
 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!