subject
Computers and Technology, 29.01.2020 01:49 uuuuyyu

Darkening an image requires adjusting all of its pixels toward black as a limit, whereas lightening an image requires adjusting them toward white as a limit. because black is rgb (0, 0, 0) and white is rgb (255, 255, 255), adjusting the three rgb values of each pixel by the same amount in either direction will have the desired effect. of course, the algorithms have to avoid exceeding either limit during the adjustments. lightening and darkening are actually special cases of a process known as color filtering. a color filter is any rgb triple applied to an entire image. the filtering algorithm adjusts each pixel by the amounts specified in the triple. for example, you can increase the amount of red in an image by applying a color filter with a positive red value and green and blue values of 0. the filter (20, 0, 0) would make an image’s overall color slightly redder. alternatively, you can reduce the amount of red by applying a color filter with a negative red value. once again, the algorithms have to avoid exceeding the limits on the rgb values. develop three algorithms for lightening, darkening, and color filtering as three related python functions, lighten, darken, and colorfilter. the first two functions should expect an image and a positive integer as arguments. the third function should expect an image and a tuple of integers (the rgb values) as arguments. the following session shows how these functions can be used with the images image1, image2, and image3, which are initially white:

> > > darken(image1,128) #converts to gray

> > > darken(image2,64) #converts to dark gray

> > > darken(image3, (255,0,0)) #converts to red

note that the function colorfilter should do most of the work.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 20:30
If chris has a car liability insurance, what damage would he be covered for
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
The gene form of a trait is called a(n) 
Answers: 2
question
Computers and Technology, 24.06.2019 16:50
How many types of string types does python support?
Answers: 1
question
Computers and Technology, 24.06.2019 21:00
Which device has the most limited computing functionality?
Answers: 1
You know the right answer?
Darkening an image requires adjusting all of its pixels toward black as a limit, whereas lightening...
Questions
question
History, 25.07.2019 18:40