Question: The edge-detection function described in this chapter returns a black-and-white image. Think of a similar way to transform color values so that the new image

The edge-detection function described in this chapter returns a black-and-white image. Think of a similar way to transform color values so that the new image is still in its original colors but the outlines within it are merely sharpened.

Then, define a function named sharpen that performs this operation. The function should expect an image and two integers as arguments. One integer should represent the degree to which the image should be sharpened. The other integer should represent the threshold used to detect edges.

(Hint: A pixel can be darkened by making its RGB values smaller.)

from images import Image def sharpen(image, degree, threshold): """Builds and returns a

?

from images import Image def sharpen(image, degree, threshold): """Builds and returns a sharpened image. Expects an image and two integers (the degree to which the image should be sharpened and the threshold used to detect edges) as arguments." pass def main(): filename = input("Enter the image file name: ") Image(filename) if image = newimage = sharpen(image, 20, 15) newimage.draw() name main() "____main___":

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Text format code Header file section for image module from images import Image Function defition of ... View full answer

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!