What value will be in those pixels after your function runs

Assignment Help JAVA Programming
Reference no: EM131104572

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?

Reference no: EM131104572

Questions Cloud

How should this settlement be reported in the 2004 : How should this settlement be reported in the 2004 financial statements? Discuss.
Determine the heat received from the hot source : Determine the Carnot efficiency associated with the present power plant and compare it with the previous result.
Experienced consumer surplus : Share 2 experiences where you experienced consumer surplus. (you paid less than you otherwise would have been willing to pay). Also share your thoughts on why the surplus happened, in other words why did you think you would pay more than you did.
What are three pros of social media : What are three pros of social media? and What are three cons of social media? When listing the pros and cons; explain your reasoning.
What value will be in those pixels after your function runs : 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
Briefly describe the physical or mental health issue : Briefly describe the physical or mental health issue you have selected. Compare (similarities and differences) the following factors for men and women: The incidence, mortality rate, diagnosis, and prognosis of that health issue.
Proper accounting suggests that the unusual gain : Proper accounting suggests that the unusual gain be reported as an extraordinary item. Illustrate an appropriate presentation of these items in the income statement.
Foundations and components of psychoanalysis : Discussing the foundations and components of psychoanalysis. Evaluate the contributions and criticisms of psychoanalytic models to the explanation of human behavior.
Problem of time lags in enacting and applying fiscal policy : Explain the problem of time lags in enacting and applying fiscal policy. What is the difference between the national debt and a budget deficit? How does the crowding-out effect relate to fiscal policy?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a histogram bar

Demonstrates an example of the user interface during your program's execution

  Working with numeric variables

Create a Java program for the following application. (it is in the second chapter of my Intro to "Java Programming" book (Murach 4th Edition)It involves1. working with numeric variables2.using the System.out object to print output to console

  Explain how you would minimize the errors

What are the three types of errors that you can encounter in a Java program? Describe them, and explain how you would minimize the errors

  Prepare an app that calculates the product of a series

Prepare an app that calculates the product of a series of integers that are passed to method   product using a variable-length argument list.

  Write down ijvm code to remove top two words from stack

Write down IJVM code which will remove these top two words, multiply and put their product back on stack. You are allowed to use existing IJVM instructions only.

  Write a java program that can serve as a simple calculator.

Write a Java program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0.

  Design your own three-stage explicit runge-kutta method

Design your own three-stage explicit Runge-Kutta method with one-step error O(h^4) - Confirm that the global error in your numerical solution is O(h^3).

  Overhead required for reading a word

A computer whose processes have 1024 pages in their address spaces keeps its page tables in memory. The overhead required for reading a word from the page table is 5 nsec.

  Determine the example of a javascriptr framework in the

what is an example of a javascriptr framework? in the framework you have described what is an example of an application

  Creating a list of shapes stored in an array

A Sample program is provided that creates a list of shapes stored in an array. This program uses classes: Shapes, Square, Rectangle and ShapesList.

  Create a class that calls that parse method

Use the Java API documentation to examine the SimpleDateFormat class and find the exception thrown by its parse() method. Create a class that calls that parse() method.

  Create a gui application with jframe

Create a GUI application with JFrame that contains five labels describing reasons that a customer might not buy a specific product (e.g. too expensive).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd