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, 22.06.2019 01:00
Ap practice - performance task response the ap create performance task asks you to write about an abstraction that you developed and wrote into your code. most of the time that means identifying a function or procedure you wrote to "manage complexity" in your program. here is the actual prompt from the create performance task: 2d. capture and paste a program code segment that contains an abstraction you developed individually on your own (marked with a rectangle). this abstraction must integrate mathematical and logical concepts. explain how your abstraction manage the complexity of your program. (must not exceed 200 words) below is a segment of code from an "under the sea" program with a rectangle drawn around a portion of the code identifying an abstraction. imagine that you wrote this and are composing an ap response about how this abstraction manages complexity. (note: ignore the requirement that the abstraction integrate "mathematical and logical concepts" for this practice response. just write about managing complexity). explain how the abstraction marked with the rectangle in the code above manage complexity of this program. write your response here submit
Answers: 2
question
Computers and Technology, 22.06.2019 11:00
in 2007, floridians died in alcohol-related collisions.a.  501b.  1,051c.  5,015d.  10,839
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
What is the most popular genre of video games?
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
You know the right answer?
Darkening an image requires adjusting all of its pixels toward black as a limit, whereas lightening...
Questions
question
Mathematics, 30.11.2019 00:31
Questions on the website: 13722362