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

Comments for Week of Sept 8, 2003

How's the class going?

Can you get help when you need it? Are you able to find TA's? Is the CoWeb helping?

How's homework #1? How's the quiz?

Comments, Questions, Gripes



Did homeowrk everything went well. Thought I submitted it late last night, realized in class I had not really submitted it and I am still having problems turning it in. I hit turn in etc..but no pop up box appears confirming. Any suggestions? gte434p

Obviously I just commented in the wrong space. sorry.


Ok, on the prequiz i have just a few questions that hopefully someone can answer. First of all, i just want to clarify, we cannot have 1.5 as a value for red right? and we have to round down to 1? Also, is it possible to have a negative value for a color value? ie. can we have the blue value be 128 - 255 = -127, can't remember that one!

The best way to know these things is to actually try it! Make a picture, get a pixel from it, then try setting the red of that pixel to -1 or 1.5, then print out getRed() of that pixel. I think that the answers are (a) no, it can't be 1.5, and I think it just truncates off the decimal part and (b) no, negative values are converted to zero. But try it! Mark Guzdial


I understand that we can't run Jes from the CD and I've followed the directions about copying to the hardrive. When I try to open it, my system says: Unable to locate suitable java runtime environment on this machine. I tried using the easy way to install but it doesn't help. what should I do?
It means that you have a version of Java on that computer, but it's an old one that JES won't run under. You should go to http://www.java.sun.com and download a new Java Runtime Environment (JRE) (it's free) for your computer. Mark Guzdial

I thought 256 is converted to zero, as it is mentioned in the book, but apparently it is set to 255.
Good observation! I'll fix that in the book. What does 257 map to? Mark Guzdial
255?
Turns out that it depends on whether you're using makeColor() or setRed() – see below. Mark Guzdial

I have a brand new computer with WindowsXP (Dell inspiron500m) so I don't understand why I don't have the correct java. When I try to download it, it says: We encountered an issue while trying to automatically install Java™ software onto your machine. As a result, Java software was not installed properly.

You may not have the right system requirements to support Java software (see the box below). Most other issues can be resolved. Please consult the Help or FAQ sections for assistance.
I don't know – I think you need to talk to Dell. Mark Guzdial

When we turnin the pre-quiz, should we include our work or just return the sheet with our answers?
Just the sheet, please. If you want to staple work to it, you can, but I don't think that you need to. Mark Guzdial

I cannot find the answer anywhere in the book about what to do when I have to subtract 128-255 for the second question. I also cannot figure out how to determine this in Jes, as the pixel's color values are not precise with JPEG files.
That's a known bug with MediaTools that we'll be fixing this week, but MediaTools isn't the only way that you know how to get and set pixel values. The answer isn't in the book. I'm trying to encourage you to experiment. Mark Guzdial

My MediaTools-Picture Tool... has some kind of bug and no matter how many pictures I name, though they show up in the drop down menu, it only displays the first one.
Again, known error (discussed on CoWeb and in class). We have a fix coming out, probably by Monday. Mark Guzdial


I don't have a book to look at but is the first problem saying change any pixels (red green or blue) to 1.5X if it is 30 distance away? or just the blue pixels? wow i'm confused...
Uh – what are we talking about here? Midterm review? Pre-quiz? Mark Guzdial

or is it the red pixels? say for (1,0,128), does it turn into (1.5,0,128) or (1,0,195)?
thanks

You are only changing the red values if the distance is less than 30. So, I believe it would be (1.5,0,128). However, some people say that 1.5 converts to 1. You may want to try it out. Good luck.
Experiment! Mark Guzdial

Myself, I haven't had to get any help so far. The only problems I've had with programs when experimenting I was able to get solved on my own. I also have felt the need to go to recitation yet, though I suspect that may change very soon.

well then can you help me with my problem (above your post)

TWO QUESTIONS:
(OOPS - THIS IS GOOD EXAMPLE OF NOT READING THE ABOVE QUESTIONS FIRST...)

Actually, I just plugged -127 in for a blue value in JES and when I asked >>>print getBlue(pixel) the value it returned for blue was 129.

I thought JES was supposed to convert negative values into 0. Any explanations?

i've tried the program on my home computer and typed it exactly as it is on the sheet and it won't work for barbara.jpg. anyone else have this problem? is the line that starts with lightBlue under the def supposed to be on the same line as def?

If you use makeColor it sets to zero, but if you use setBlue (or any other color) it seems to wrap around.



Yes, it seems that makeColor and setBlue/Green/Red do different things. Do experiments like the below to check it. (AND PLEASE MERGE IN SOMEONE ELSE'S CHANGES WHEN TWO PEOPLE EDIT AT ONCE! THIS IS MY SECOND TIME TO TYPE THIS IN!) Mark Guzdial
>>> p=makePicture(pickAFile())
>>> x = getPixel(p,10,20)
>>> print x
Pixel, color=color r=167 g=130 b=103
>>> setRed(x,-15)
>>> print x
Pixel, color=color r=241 g=130 b=103
>>> print 255-15
240
>>> print 256-15
241
>>> setRed(x,256)
>>> print x
Pixel, color=color r=0 g=130 b=103
>>> setRed(x,257)
>>> print x
Pixel, color=color r=1 g=130 b=103
>>> setColor(x,makeColor(12.5,-15,300))
>>> print x
Pixel, color=color r=12 g=0 b=255


In Lab 3
When I try to square a function composed of cell names e.g. "=(G2-$H$2)^2" I only get ########## G2 and H2 both have number in them.... whats going on. Ive used excel before and this hasn't happened!?

But it works with just numerical values like "5^2" returns 25

nevermind, my cell wasn't wide enough


I've been trying to do the resize function from the book and it simply doesn't work. I'm pretty sure I copied it right, I checked it a couple times, I've tried the resizing function and the copying function from the slideshow and they both work (they're specific to barbara.jpg) and I've compared them to the function in the book and as far as I can tell it should work. Other than typos, is there something I might be doing wrong?

Could you be more specific than "it simply doesn't work"? WHAT doesn't work? What DOES happen? WHICH function were you typing in? Did you remember to setMediaPath() before running them? In the 3pm class Wed., we actually recreated the scale up and scale down functions for one of the student pictures and it worked fine. Mark Guzdial


It's the resize function on page 73 in the book. What happens is I put in a picture and a value (I've been trying 2) and it instantly gets to the end and shows the blank target (since I added that in).
Ohhhh – I forgot about that one being in this version of the book. I suggest using the scaling functions that we use in lecture. But yes, it does work. Instead of using "2", try "2.0." It's an integer vs. float issue. It works for me – just tried it. Mark Guzdial

Here's the resize code with indentation right:
def resize(source,increment):
  newWidth = int(getWidth(source)* (1/increment))
  newHeight = int(getWidth(source)* (1/increment))
  target = makePicture( getMediaPath("7inx95in.jpg"))
  sourceX = 1
  for targetX in range(1,newWidth):
    sourceY = 1
    for targetY in range(1,newHeight):
      targetPixel=getPixel(target, targetX, targetY)
      sourcePixel=getPixel(source, int(sourceX), int(sourceY))
      setColor(targetPixel,getColor(sourcePixel))
      sourceY = sourceY + increment
      if sourceY > getHeight(source):
        sourceY = sourceY- getHeight(source)
    sourceX = sourceX + increment
    if sourceX > getWidth(source):
      sourceX = sourceX- getWidth(source)
  show(target)
  return target


where are grades for homeworks and labs posted? also, when will the exam review be posted?
thanks
Grades are posted in WebWork. Exam review is at the top of every page here Fall2003 Midterm Review 1. Mark Guzdial

I tried the generalized changeColor, and I can't get my function to work. This is what i did for the first problem in the midterm review.

def changeColor(pict):
for p in getPixels(pict):
int1=getRed(p)
setRed(pict,-.10,1)
int2=getGreen(p)
setGreen(pict,.30,2)
int3=getBlue(p)
setBlue(pict,0,3)

where am i going wrong?

correction of the above
def changeColor(pict): for p in getPixels(pict): int1=getRed(p) setRed(pict,-.10,1) int2=getGreen(p) setGreen(pict,.30,2) int3=getBlue(p) setBlue(pict,0,3)

there is an indentation before for and before the int1,2,3... as well
Read the FAQ on how to post code in the CoWeb. setRed/Green/Blue take a PIXEL as input, not a PICTURE. And this isn't a good place to discuss midterm review problems – there are pages for that. Mark Guzdial




Link to this Page