![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Yes, that's fine. If you put a show(picture) at the end of your code, it will automatically come up, but you're not required to do that. - Bobby Mathew |
| Webwork accepts submissions till midnight (grace period), so you can still get help after recitation and still have a few hours left to turn it in without losing any points for turning it in late - Bobby Mathew |
| You don't need that line at all. You are using pickAFile(), so you don't need to specify any path. - Bobby Mathew |
| You can set the red value of the pixel to the blue value of that pixel and vice-versa. - Bobby Mathew |
| That wouldn't work because its not right syntax. Also, you don't have to setGreen to anything. Only change the red and blue values of the pixels. - Bobby Mathew |
|
In general, if you want to swap 2 values, you can do it 2 different ways: def swap1(): value1 = 3 value2 = 5 value1, value2 = value2, value1 # Swaps the values print value1 print value2 def swap2(): value1 = 3 value2 = 5 temp = value1 # Storing value1 in a temporary variable called temp value1 = value2 # Taking the second value and putting it into the first one value2 = temp # Putting the temp value (which is value1) into value2 print value1 print value2 Use the swap statements from either of the above functions in your PosterizeMe function. - Bobby Mathew |
| I just wrote 2 functions so you can see how it works. In your code, just use the statements that actually switch the values. Don't worry about def, value1, value2, print etc. - Bobby Mathew |
| Swapping the red and blue values mean taking the blue value of the pixel and doing setRed to that value and vice versa. You don't need to use setGreen at all. - Bobby Mathew |
| Yes, you can do that. - Bobby Mathew |
| The term 'green pixel' doesn't exactly make sense. Every pixel has 3 color components - red, green and blue. - Bobby Mathew |
| Don't repaint(picture). When we grade it, we'll use show(picture) from the command line. - Bobby Mathew |
| Try putting a show(picture) statement at the end of your code. If the original picture shows up instead of the posterized one, it means that your code isn't correct. Also, when you do writePictureTo, make sure you're copying the correct picture over, although this shouldn't be a problem because there's only one picture in the entire function. - Bobby Mathew |
| We can take off the other picture later. We'll only check the new one when grading it. I'm not sure what the exact problem might be but make sure you did the following: Using writePictureTo(picture, "C:\.................\gtXXXX.jpg"). If you did that correctly, try saving it in another folder instead of mediasources. Once you save it, open up the image, make sure its posterized and then put it on the site. If you still have problems, email one of the TA's with your code. - Bobby Mathew |
| When you do pickAFile(), you have to pick a jpg image and then use that in your function. You have to be more specific with the error. Since the assignment is almost due, email/IM me if you need help. - Bobby Mathew |