Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Fall 2003 Take Home Exam 1 Questions Page

Here's where you can ask questions about the Take Home Exam 1.
You are welcome to ask questions about any of the programs in the book or in the slides, or any of the topics in the class (e.g., "I don't understand mirroring – can you help me go through it again?") but you cannot ask anyone (even the TA's or teacher) about your own solution. DO NOT POST ANY OF YOUR CODE ONTO THIS PAGE IN ASKING QUESTIONS!


Comments? Questions? Wonderings?



Does my code need to return the canvas as a file or anything? Does all it have to do is create the image and then it's done? Jeff Baker
Yes, all you have to do is create the image. You don't need to write to a file because your resultant image should look the image provided on the Take-Home Exam page. Your TA will only setMediaPath() and then execute exam1(). Angela Liang
It should show() the image – I'll add that to the problem. Mark Guzdial

when is it due?
The take-home exam is due on Friday, Oct. 3 at 5 pm. Angela Liang


Could you please explain-"The two rows should be very close, even touching". The image that you have posted does have a space between them. By touching do you also mean that it does not have any space between them?
Notice where the diagonal line meets. The space between the original image and the mirrored image is very close. We expect there to be a little difference between the image we have and the image you are expected to produce. But no more than 5 pixels of whitespace. We also don't want the image to overlap when mirrored. Therefore, pay close attention to the diagonal line when looking at your resultant image. Hope this helps. Angela Liang

do i have to turn in the picture also or jsut the code
Just the code. Angela Liang

What...? We don't get a page to post each of our resulting images this time? Ah-well... =)

The honor statement should be entered into the "comment area". This is the same space as the "Notes to TA" area, right?
Yes.

The whole thing took me 10 minutes :-)

Do we have to create that picture in the exact order you explained it? Could we start at the bottom and mirror to the top?

sorry, nevermind the last question...I figured it out.

sorry, nevermind the last question...I figured it out.

hw took longer than the exam... odd.

Yay this made me happy I actually knew what I was doing... didn't take me long at all :)

okay- you would like us to mirror the two images from top to bottom. However are we allowed to mirror the canvas or just the pictures. IS it okay, if there is more than one way to do this.
Yes, there's more than one way to do it. As long as the effect is the same, you can use the order you'd like. Mark Guzdial


so you saying we can mirror the canvas or the image. The most important aspect is achieving the same result as the picture. Thank you, just want to be really sure before completing the assignment.
Yes, I am willing to accept either one. Mirroring the canvas is easier, of course – you only have to do ONE mirroring. Mark Guzdial



I'm having difficulty understanding why it is that when we mirror, we put "y+mirrorpoint" and "mirrorpoint-y". Additionally, how do we know whether to place the "y+mirrorpoint" term in the "y" slot for p or for p2? It seems to me that the "y+mirrorpoint" term should not cause the program to run out of bounds and thus cause an error in the program because the target y value for the original picture is targety=1. If the mirrorpoint is placed at getHeight(picture), the image should be reflected where the largest value which results from y+mirrorpoint is the getHeight(picture) + getHeight(picture) which still should be within the bounds of the 640x480 canvas. I may be incorrectly reasoning this, but I would appriciate some help in understanding the function of the "y+mirrorpoint" and the "mirrorpoint-y".

Nevermind the last entry. I figured out why I was not understanding what I was doing wrong.
Cool! For everyone else who was wondering similar wonderings: Think about the mirrorpoint as LITERALLY the place where the mirror is. How does the image get onto the mirror? We copy pixels from the image side of the mirror onto the mirror. If the mirror is on a vertical line, than pixels to the left of the mirror are less than the mirrorpoint (e.g., mirrorpoint-x). Pixels to the right of the mirror are more than the mirrorpoint (e.g., mirrorpoint+x). If the mirror is on a horizontal line, than the top is less than the mirrorpoint (mirrorpoint-y) and the bottom is more than the mirrorpoint (mirrorpoint+y). To get the image onto the mirror copy the pixels from one side to the other. If we're copying top to bottom, we copy mirrorpoint-y to mirrorpoint+y. Hope that helps! Mark Guzdial


I am having the same problem trying to understand mirroring and the error message ArrayIndexOutOfBoundsException. Could you shed some more light on this issue?
For anyone that's having problems with mirroring, the TAs will be going over mirroring in recitation this week. Angela Liang
In general, if you reference an index (your X and Y in getPixel or setPixel) is beyond the getHeight or getWidth of the picture, you'll get this error. The best way of tracking these kinds of errors is to use a Print statement to see the values and see what values you have. Mark Guzdial

I wrote the program and it works fine. But, when I write the picture to a file then try to open it up with media tools only the original jpeg shows up. If I open the file with any other viewer program the entire image shows up. Any suggestions or explanations?

Maybe you're accidentally returning the figure and not the canvas? I don't want to go any further down this path – we can't be debugging your program. Mark Guzdial
If you've already opened the picture once in the picture tool, it will only open that picture until you restart JES. This is a bug that is fixed in the new version of JES: Course Software (JES) Adam Wilson


where should the media directory be?
Shouldn't matter. Just setMediaPath and use getMediaPath in your program, and you don't need any directory paths. Mark Guzdial

No matter what I type in for my targetX and targetY, my result always looks the same, and it is not the right thing. Any ideas of what I might be doing wrong?
It really doesn't matter what you put in for targetX and targetY? In that case, I'd wonder if your loops are working at all. If you have a loop like this: for sourceX in range(1,1):, the loop never even starts. You might put in some print statements to find out what's going where. Mark Guzdial


Hasta la vista, Take Home Exam 1.

If you switch the order of the colors in the negative definition the negative will look different than the one we are supposed to turn in as the negative. Why is that?
Because makeColor() always takes its inputs in the same order: red, then green, then blue. If you instead pass in the inputs blue, red, green (for example), then the colors will get juggled. Mark Guzdial

Is it still ok to use other functions?
yes, you can still use other functions. Just make sure your main function is exam1(). Angela Liang

I am able to create the original "myfigure" fine and copy the negative next to it with no problems. However, I am having some trouble mirroring the images beneath the originals. I think it may be because my original images are located at the bottom left of the canvas and not the upper left. Would this cause a problem? How would I fix this? Thanks.

Yes, that would be a problem. You fix it by setting targetX and targetY so that the images compose in the upper left hand corner. Mark Guzdial


is it ok to save myfigure as a ".jpeg" file instead if a ".jpg" file?

my computer wont let me save the image to anything but a bitmap file how do i make it give me the option to save it as a jpg file?
nevermind

does my code have to be general to be able to take any picture as input or can i make it specific to this picture
Just this picture. Mark Guzdial

I don't know how to test to make sure my file is working in the bottom. I have the code complete. I don't have problems doing the code, I can do that, I just get confused as to what to type initially into the command area, and then when to "save and load" and then see the final product.
Open up your program. Then save it. Then hit load. After you have loaded it, type in exam1() (which should be the name of your program) in the command area and hit enter/return. It should run the program and show the canvas.
That answer is right, but how did you get all the other homework turned in? Mark Guzdial


where can i find the blank canvas jpg (640 by 480)?
In the MediaSources directory on your CD. Mark Guzdial


i had no problems with writing the program but when i try and execute it in the black part of JES i keep getting this weird error that i have never got before-it says that i basically have a typing error and that i either have not used enough parenthesis or have tried to make something a function that isnt one. i know for a fact that my program is correct because i've checked and rechecked it a million times and cant find anything mistyped. any suggestions on what this error could mean???
It can't be correct if you're getting that error. Try rewriting the line it's complaining about. Use more or fewer parentheses so that you're doing something different. Check all your spacing. Mark Guzdial
Iam having trouble placing my picture on the upper right hand corner of the canvas.. Instead its on the lower right hand corner.. So when i mirror it top to bottom both pictures dont show up, when i take the mirror function out. the pictures come up in the lower right hand corner.. and when i mirror top to bottom the mirrored picture comes up on the top of the canvas.. with a large gap and then my original pircture and negated picture on the bottom.. any ideas what i should be looken for to correct this problem?

It should be in the upper LEFT hand corner, not the lower right. We discussed how to get it in the upper left in class. Mark Guzdial

where do you get the myfigure.jpg from? I cant find it
By saving it on your computer from the Take Home Exam page. Read the directions there. Mark Guzdial

should we setMediaPath to the c drive or d drive(where the cd is). I am not sure. I have both of my images saved under the c drive in my images file. However, I am not sure if my TA would be able to work the program this way. let me know.
Neither. The Media Path should be set to the DIRECTORY where the media are, not just the drive. Keep clicking until you get to your MediaSources directory. Mark Guzdial



what time is this due?

5:00 pm EDT today (Friday, October 4, 2003). Mark Guzdial


Mark, do you have a sample mirror code that i could look at? I have everything done but it doesn't seem to work. I would look in the book but i lost it. Or where can i go to read up on it. thanks Matt Dahlhauser

All the slides are on the Web on the Syllabus page. Look at the slides on pixels by index number. Mark Guzdial




Links to this Page