Question: you have to complete this function based on C0 Programming language. If you don't know about the language, please let someone else do it. /*

you have to complete this function based on C0 Programming language. If you don't know about the language, please let someone else do it.

/* Task 5 - Implement quantize() as described in the writeup */

pixel_t quantize(pixel_t p, int q) //@requires 0

you have to complete this function based on C0 Programming language. If

Task 5 (3 points) Complete function quantize in file tasks.co. Quantization is a transformation on pixels. It can be performed on all the pixels in an image to reduce the total number of colors used in that image. Given a pixel and a quantization level q in the range (0,8), we quantize by taking each color component (red, green and blue) and clearing the lowest q bits. For example, suppose we have a pixel with red intensity R = 107, green intensity G = 190, and blue intensity B= 215. The color components of this pixel are represented by these bytes: RED GREEN BLUE 01101011 10111110 11010111 If the quantization level is 5, then the resulting pixel should have the following color com- ponents (note how the lower 5 bits are all cleared to 0): RED 01100000 GREEN 10100000 BLUE 11000000 A pixel processed with a quantization level of 0 should not change. For each pixel, do not change its alpha component. Task 5 (3 points) Complete function quantize in file tasks.co. Quantization is a transformation on pixels. It can be performed on all the pixels in an image to reduce the total number of colors used in that image. Given a pixel and a quantization level q in the range (0,8), we quantize by taking each color component (red, green and blue) and clearing the lowest q bits. For example, suppose we have a pixel with red intensity R = 107, green intensity G = 190, and blue intensity B= 215. The color components of this pixel are represented by these bytes: RED GREEN BLUE 01101011 10111110 11010111 If the quantization level is 5, then the resulting pixel should have the following color com- ponents (note how the lower 5 bits are all cleared to 0): RED 01100000 GREEN 10100000 BLUE 11000000 A pixel processed with a quantization level of 0 should not change. For each pixel, do not change its alpha component

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!