PROBLEM 7 (12 pts) - Sorting colors by percieved luminance Write a function which receives as input a list of tuples, wh
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
PROBLEM 7 (12 pts) - Sorting colors by percieved luminance Write a function which receives as input a list of tuples, wh
PROBLEM 7 (12 pts) - Sorting colors by percieved luminance Write a function which receives as input a list of tuples, where each tuple represents a color in the RGB color model. def sortColorsByLuminance(listofRgbColors): In this model a color is represented by three values (the value of Red, Green and Blue), each varying from 0 to 255. The perceived luminance of a color is calculated as: Luminance = 0.3 R + 0.59 G + 0.11 B (Note: this is due to the fact that humans perceive some colors brighter, for example green is perceived brighter than blue). The function should return the list of colors sorted by luminance (brightest to darkest).
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!