Question: In Python pixelLuminance (r, 8, b) Write the function pixelLuminance that takes 3 integers r, g, and b, each between 0 and 255 (inclusive), representing
pixelLuminance (r, 8, 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 (rb) may be found on page 4, item 3.2 of the technical report Parameter values for the HDTV standards for production and international prograsme 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 co to red, green, and blue (roughly). Why do you think each value is an integer between 0 and 255? satisfies the constraints, so pixelLuminance). you don't In the remaining questions, you may assume that the input data s need to check the type or value of the parameters (like you just did in pixelLuminance (r, 8, 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 (rb) may be found on page 4, item 3.2 of the technical report Parameter values for the HDTV standards for production and international prograsme 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 co to red, green, and blue (roughly). Why do you think each value is an integer between 0 and 255? satisfies the constraints, so pixelLuminance). you don't In the remaining questions, you may assume that the input data s need to check the type or value of the parameters (like you just did in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
