


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A laboratory assignment for the computer science i course (cis 201) at georgia tech, where students are required to manipulate images using classes from the mediacomp project. The assignment covers topics such as reading and displaying pictures, negative images, working with pixels in the (x,y) coordinate system, and adding vertical bars to images. Students are expected to compile and run the provided java programs, modify them according to the instructions, and submit the results.
Typology: Lab Reports
1 / 4
This page cannot be seen from the preview
Don't miss anything!
In this lab you will manipulate images using classes from the Georgia Tech MediaComp project. See http://coweb.cc.gatech.edu/mediaComp-plan/101 for more information on this project.
Files from this project can be found in
/home/student/Classes/MediaComp
and the documentation for the Java class used in this project can be found by following the Documentation link on the CS homepage.
Copy the file
/home/student/Classes/201/Labs/Lab10/Pic.java
into a suitable working directory. You should be able to compile and run this file directly, with a copy of the raptor picture displayed on your screen.
File other .jpg files on your system (use the locate command!), or find ones on the web and download them to your current directory. Modify the program so that the picture to be displayed is given as a command line parameter, in args[0].
Show us some of your pictures!
Copy the file
/home/student/Classes/201/Labs/Lab10/Pic1.java
into your working directory and change the /* FIXME */ part so that it will use the command line parameter args[0] as the filename.
If you compile and run this program, it should display the picture exactly as the previous program, since the “new” pixels defined using setColor have the same red, green, and blue values as the original ones.
To make a “negative image”, you will want to change the values of red, green, and blue values so that they go from 255 to zero instead of from zero to 255. Specifically, given the value r for red, find a simple expression that will evaluate to 255 if r is zero that will evaluate to zero if r is 255, and that will handle values inbetween as well, as illustrated in the following table old r new r 0 255 1 254 · · · · · · 255 0
Then do the same thing for green and blue. Your actual parameters r, g, and b in the new Color(...) constructor should be replaced by these expressions.
Run your modified program with several pictures of your choosing.
(If you wish, you can use the grayscale conversion as described in class to produce a black-and- white “negative” image instead of the color one that we are describing here.)
Show us your work at this point. Your displayed pictures should look like “negatives”.
Instead of treating the image pixels as a one-dimensional array, we can also look at them in the ( x , y ) coordinate system, where (as we do in FANG), the origin ( 0 , 0 ) is at the top-right corner. The height and width of the picture can be obtained using methods defined in the Picture class.
Copy the file
/home/student/Classes/201/Labs/Lab10/Pic2.java
Well, try something of your own choosing.
And show us!