- Find the project name in the Package Explorer window. It should be named by your last name, a hyphen, and your student ID number.
- Right- (control-) click on that.
- Go down to Team
- Choose Update
- Authenticate with your WUSTL key as usual
The leftmost panel should contain a photograph of Brookings Hall and Chancellor Wrighton should appear in the other two panels, respectively.
Note that you can use the radio buttons beneath the three panels to select which image(s) the methods manipulate (sources) and where the output is placed (target).The other methods won't do anything interesting... yet.
def sum(a, b, c): return a + b + cRecall that each pixel of an image has three color components (red, green, and blue), and that each of these components is an
int value in the range 0 to 255, where 0 is no intensity and 255 is full intensity.
In this part of the lab, you write methods whose parameter(s) and return values are such integers, each representing a
color component of a pixel.
When you execute these methods, the ProcessorTool will apply them to every
component of every pixel of the image to produce a new image.
In the file ImageProcessor.py, complete the provided stub methods as described below. In the method bodies, use mathematical expressions. Do not use a conditional (if) statement.
Take some time to think about the mathematical function that has this property. Try this on paper before trying this in code!
Remember that you are not allowed to use conditionals (if) statements for this part of the lab.Recall that color components are in the range 0-255. Also, recall that if you divide an int by another int, the result number will be truncated. For example
- 130 / 128 = 1
- 125 / 128 = 0
Each pixel of an image is represented as a pyNIPColor instance. The functions you write for this part will accept and return such instances.There are two things you need to know to use pyNIPColor:
- To construct a pyNIPColor object, you write
pyNIPColor(r,g,b)where r, g, and b are values for the red, green, and blue components, respectively. For example
pyNIPColor(0,0,0) is the color black pyNIPColor(255,255,255) is the color white - If you have a pyNIPColor instance c, then you can access its components by
- c.getRed()
- c.getGreen()
- c.getBlue()
For now try something simple, and revisit this problem once you know more python to try a more sophisticated model for brightness.
- Be brave: pattern what you do after the code you see to add your new menu choice.
- Run ProcessorTool and make sure you see your new item. Click on it, but nothing will happen because we have not yet put in the code to act on the choice.
Try running ProcessorTool again, and try your new menu choice. What happens?
Does it take a pixel component, one pyNIPColor instance, or two instances?copy and paste code that already handles a similar scenario, and arrange for that code to call your corresponding method in ImageProcessor.
When you done with this lab, you must be cleared by the TA to receive credit.
- Commit all your work to your repository
- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in his or her name
- Click OK while the TA watches