Question: IN Python pixelLuminance (r, g, b) Write the function pixelLuminance that takes 3 integers r, g, and b, each between 0 and 255 (inclusive), representing

IN Python

pixelLuminance (r, g, b) Write the function pixelLuminance that takes 3 integers r, g, and b, each between 0 and 255 (inclusive), representing the red, green, and blue intensity of a pixel and returns the luminance of this pixel as an integer. The function expects each parameter r, g, and b to be an integer in the interval [0,255]. You should use assertions to enforce this constraint. The formula for the luminance of a pixel with RGB values (r,g,b) may be found on page 4, item 3.2ofthetechnicalreportParameter values for the HDTV standards for production and international programme exchange: ITU-R BT.709-6 (June 2015), which is available here (and I have also downloaded to Canvas under Files/hw/hw2). This formula will yield a float, which should be rounded to the nearest integer, with ties going away from zero, using the function roundHalfUp that I have provided. Other rounding modes are reviewed in the Python documentation here. Context: this conversion is how a colour image is converted to a grayscale image. In computer vision, the area of computer science that studies the interpretation of images, computation is often cleaner with a grayscale image. We might explore images later in CS103 using OpenCV. Images are two-dimensional arrays of pixels. A pixel is a picture element, the smallest addressable element of an image and of a display. In modern graphics hardware, the colour of a pixel has 3 colour components, red, green, and blue, whose intensities are controlled by 3 electron guns. This mirrors the human eye, which has 3 types of cone that respond to light at wavelengths corresponding to red, green, and blue (roughly). Why do you think each value is an integer between 0 and 255?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!