If your picture had a pixel color pure red rgb 255 0 0 and


Write a function called posterizeMe(). Your function should take a picture as an input parameter. The first line of your functions should look something like this: def posterizeMe(picture):

Your function should do the following for every pixel in the picture (in this order):

- If the original red value of the pixel is greater than or equal to 90, set the new red value of the pixel to 255

- If the original blue value of the pixel is less than 90, swap the values of the red and blue for that pixel e.g., make the new blue equal to the old red, and the new red equal to the old blue)

- If the original red value of the pixel is greater than 80 and less than or equal to 167, set the new red value of the pixel to the original green value

- If the original green value is greater than 130, set the new green value to 130.

- If the original green value is less than or equal to 130, set the new red value to the absolute value (hint: function abs()) of the original blue value minus the original red value

Test your new function with various pictures. Use the writePictureTo function to save one posterized image, and the original image. You will be submitting these images along with your py file.

Make sure you have added appropriate comments for your new function.

Analysis Questions: answer this questions as a comment below your function

(a) If your picture had a pixel color pure red (RGB = 255, 0, 0) and another pure blue (0, 0,255), what value will be in those pixels after your function runs?

(b) It is important to store the original red, green, and blue values before you start. Why?

Solution Preview :

Prepared by a verified Expert
JAVA Programming: If your picture had a pixel color pure red rgb 255 0 0 and
Reference No:- TGS01482571

Now Priced at $25 (50% Discount)

Recommended (99%)

Rated (4.3/5)