This lab assignment will have you write a jython program that will use some built-in JES functions to retrieve some basic information about an image.
In the ACCC Labs, JES can be found by:
Of course, these comments may help a person understand what is going on, but they normally confuse a computer reading the program. Thus we need to use a special symbol to inform the computer where the comments are so the computer can ignore them.
In JES, the # character is used to indicate a comment to the computer. The # character is often called the "pound" character, the "sharp" character or the "number" character. Prof. Troy refers to it as the "pound" character; however, many people use the term "sharp" after the music notation. Also Microsoft's programming language C# is called "C sharp".
In JES, anything typed on a line after the # character will be considered a comment and ignored. JES displays comments in green text and the # character is also part of the comment.
At the beginning of every program, you will now be required to have a comment (or multiple comments) that contains your name, your NET-ID, the class name, assignment name and a short description of the program. Thus each program should begin with something similar to the following:
# Pat Troy # troy@uic.edu # CS 100 - Lab 10 # # A short program to display the color intensity of # the last pixel in an image. |
You should check out the JES command of pickAColor() to play with the various colors. You can just type in pickAColor() in the command window to see how it works.
This command takes as input an image that was created using the makePicture() command (see lab 9 for discussion of makePicture() ). The value returned will be the width of the image given as input. The width will be the number of columns of pixels in the image.
This command takes as input an image that was created using the makePicture() command (see lab 9 for discussion of makePicture() ). The value returned will be the height of the image given as input. The height will be the number of rows of pixels in the image.
This command will take three values as input. The first value will be an image that was created using the makePicture() command (see lab 9 for discussion of makePicture() ). The second value will be the column of the pixel to be accessed. The third value will be the row of the pixel to be accessed. The value returned will be pixel from the specified image at the specified column and row.
This command will take a pixel as its input. The pixel is often first retrieved from an image using the getPixel() command. The return value will be the intensity of the color red in the pixel. The returned value should be in the range from 0 to 255.
This command will take a pixel as its input. The pixel is often first retrieved from an image using the getPixel() command. The return value will be the intensity of the color green in the pixel. The returned value should be in the range from 0 to 255.
This command will take a pixel as its input. The pixel is often first retrieved from an image using the getPixel() command. The return value will be the intensity of the color blue in the pixel. The returned value should be in the range from 0 to 255.
Create a file using JES that will
The "last" pixel in the image is the pixel in the very last column and very last row of the image. Remember the width of an image gives the number of columns and the height of an image gives the number of rows.
On the ACCC lab computers, the H: drive is a permanent storage area for you. Saving files to this drive on one computer can be accessed from another computer (even another computer in a different lab). It is suggested that you save your python programs to the H: drive.
Use the UNIX turnin command to electronically hand-in your python file using the project name of lab10. Note: you will need to transfer your python file to your icarus account before you can use turnin. You can do this by using the file transfer function of SSH or by emailing your python file to your incarus account. To submit the file in <filename>.py for lab10, the turnin command is entered as:
turnin -c troy -p lab10 <filename>.py