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 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 23.06.2019 07:00
Why were most movies from the late 1890s until the early 1930s only filmed in black and white? there were only a few people who could afford the technology to produce color motion pictures back then. audiences did not want color motion pictures until later. the film used to make color motion pictures often overheated, which was a safety hazard, so it was generally not allowed. color films had to be hand-colored, frame by frame.
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
How many types of string types does python support?
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, 18.07.2019 02:00
Questions on the website: 13722361