![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| You're right, it isn't a function. It's a method. But it's there, trust me. (page 328 of the textbook) -Blake O'Hare |
| As long as it's some sort of n-framed motion sequence, it will suffice. -Blake O'Hare |
| You are supposed to use only a couple pictures of a person walking looping over and over for the 50 frames. Mod is remainder. If you have 4 pictures called person0.jpg, person1.jpg, person2.jpg, person3.jpg, then you would use person(frame number mod 4).jpg as the picture to copy. For example, on frame 27 you would use person3.jpg because 27 / 4 has a remainder of 3. On frame 28, you would use person0.jpg because 28 / 4 has a remainder of 0. -Blake O'Hare |
| Your object should walk across the screen. -Albert d'Heurle |
| The figure would just slide across in that case. (I suppose that would look ok if the figure were a skater). Using different pictures will give the impression that the figure is going through a walking motion. Colin Potts |
| Everybody should check that their submission meets the items in the checklist on the Homework 3 page. Two of the items are as follows: (1) Your function takes in a directory, (2) Your function outputs frames to that directory. Colin Potts |
| Mod is denoted by the % symbol. This will be gone over during recitation this week. -Blake O'Hare |
| The mod function should be discussed in recitation. Liz Helms |
| no. Liz Helms |
| The Media Tools tab will only display pictures that you have loaded or manipulated in the command area of JES, i.e.: >>> picture = makePicture(pickAFile()) etc. If you want to see all your pictures go together like a real movie, google a movie maker program that will take all your frames and put them together smoothly. Thats all that I know of that will let you view them like that... Liz Helms |
| Mediatools can do this, but it is a bit flakey. In Mediatools, select the VideoTools panel. A blue widget will appear with buttons 'Open' 'Menu' 'Windows' etc. Click 'Menu'. In the drop-down menu that now appears, select the bottom item ('Create JPEG movie from folder of frames'). Another drop-down menu appears, this time containing files and directories. You should be able to work out how to navigate to the folder containing your JPEGs. Select the FIRST frame in the sequence you want to view as a movie and MediaTools will add the rest of the files one after another automatically. In the sequence of pop-ups that now appear, give your movie a name, select a quality level (too high may cause you to run out of memory: I use 50 in class, and it always works, although a bit low-resolution), and a frame rate (16 fps should do it). You will then see your movie run before your very eyes, and it should be saved in a .jmv file. Remember that to run Mediatools in the first place, you drag the Mediatools icon onto the SqueakVM icon. Double clicking on the Mediatools icon probably won't work. Colin Potts |
| Nothing would surprise me! But, I can't reproduce this behavior (Can anybody else?) so I am at a loss. Maybe you missed out the leading zeroes and that is throwing MediaTools? Or maybe the final fourteen frames are the same as number 36, so you're seeing no changes? Colin Potts |
| Look up addTextWithStyle in the index of your book. -Blake O'Hare |
| Use an if statement. if frame <= some number: do something if frame > some number: do something else. -Blake O'Hare |
| My advice is NOT to use MovieMaker. I can't get it to work on the Mac, and apparently it crashes regularly on the PC. My recommendation above is to use MediaTools, which is a completely different program. Liz's advice about googling is if you want to look on the web for free or commercial media tools. That shouldn't be necessary unless you want production-quality software. Mediatools is clunky, but it does work. Colin Potts |
| I explained it above. Instead of complaining that you don't understand, read my advice carefully and follow it. (MediaTools is a Squeak program.) If you are still confused then, wait until class tomorrow and I will demonstrate MediaTools in class then. Colin Potts |
| We will only be checking to see if your program generates a bunch of JPEGs. Actual animation is up to you. -Blake O'Hare |
def writeFrame(dir,pic,frame):
framenum= str(frame)
if frame < 10:
writePictureTo(pic, dir+"/frame0"+framenum+".jpg")
if frame >= 10:
writePictureTo(pic, dir+"/frame"+framenum+".jpg")| Well, your code looks perfect, which means the problem must be earlier. Are you sure you're passing your 3 parameters in your other function in the same order that you have them written in the def statement? -Blake O'Hare |
| The default addText function makes black text. If your background is black, then yes, that is the problem. You can either change the color of the background, or you can use the addTextWithStyle method which allows you to add text with different color/font/size. -Blake O'Hare |
| When you definded your annimation fucntion did you use dir so annimation(dir) or did you directory so annimation(directory) -Albert d'Heurle |
| How are you defining what dir is? I think the easiest way is to say dir = pickAFolder() and then navigate to where you want the images created. -Albert d'Heurle |
| You're not alone. Are you sure that you have set dir to a directory? Try to get this to work by leaving dir off (i.e. writePictureTo(pic, "/frame0"+framenum+".jpg") and see whether that works. This will write the files to the wrong directory of course, but if it works, you know you are passing in the wrong value of dir to the function that calls writePictureTo() Colin Potts |
| Are you sure you that the input is a picture and not a file containing a picture? (I.e. Did you forget to makePicture() it?) Colin Potts |
| MediaTools is on the CD included with the textbook. I'm not sure why it is not available for download. Media sources is something different: it is the folder containing all the example pictures and sounds. Colin Potts |
| You can now download Media Tools from this link Media Tools -Albert d'Heurle |
| can we see your code to write the picture to the computer -Albert d'Heurle |
| Are you sure your chromakey code is correct. That seems like a long time to run the code -Albert d'Heurle |
| This is wrong. If your code takes more than a few minutes to run, there is something wrong with the layout of your code and you are possibly double-nesting for loops where they shouldn't be. But in order for chromakey to work, it needs to be done every frame. -Blake O'Hare |
| That's fine. JES can read 2 kind of picture file types: .jpg and .PNG. Remember that these things tend to be case sensitive. -Albert d'Heurle |
| That's what your directory variable is for. It's what you pass into your function. -Blake O'Hare |
| Never use a \ by itself in a string. Use \\ if you want a backslash character, or // if you're using it for a directory delimiter. -Blake O'Hare |
| Look for missing quotation marks, closing/opening parenthesis, colons, etc. -Blake O'Hare |
| Spacing errors can be tricky. Basically there is a problem with your indentions. Make sure everything is indented the same way throughout your code. i.e. you used all tab spacing and in one spot you used one space spacing. -Albert d'Heurle |
| Can you go to a TA's office hours? -Albert d'Heurle |
| I would recommend you email her....it might be a better method of communication than via the questions page. Liz Helms |
| getMediaPath takes in a filename and looks for that filename in the mediasources. It will then return a full path to that file. For example: | >>>getMediaPath('boot.jpg')
>>>C:\Documents and Settings\Larry\My Documents\cs1315\JES\boot.jpg |
| What you are more interested in is probably setMediaPath. Use that inside the command window. That will open a chooser to let you select a directory. Then you can use getMediaPath("myPicture.jpg") to actually get access to the picture you want. Larry Olson |   |
| Typically, this means that you are trying to access a pixel that is outside the picture. For example: A pixel located at 150,150 is NOT going to be in a 100X100 picture. Likely you are passing large destination values into your copy function. The values are likely so large that as soon as 1 is added to them, you are going out of bounds. Larry Olson |
| Mod is the % sign. It returns the remainder after division. Example 5%2 = 1, 6%2 = 0, 5%3 = 2, 6%3 = 0, 7%3 = 1 etc. Larry Olson |
| JES typically looks for pictures inside its own path. Therefore, unless you are explicity using the directory you pass in to open the pictures you need for your movie, then it will looks there. Perhaps you could try setMediaPath() ? Larry Olson |
if frame<10:
writePictureTo(background,directory+"//frame0"+framenum+".jpg")| make sure that you have converted framenum to a string using the str() function. Larry Olson |
| no, mediaPath and the directory are not the same thing. Amanda Bennett |
| We will type setMediaPath() and pickAFolder() in the command area. Tia Doppenberg |
| This is where the mod function comes in handy. You can use mod with if statements, and in those if statements you can decide which picture to put on to the background. You can use other ways though. Tia Doppenberg |
| Yes, that's fine. Someone else is using swimming. As long as the figure doesn't slide .... i.e. there is a difference in appearance – leg or arm position, or orientation – from frame to frame. Colin Potts |
| I don't understand your problem. What isn't moving across the screen? Are you saying that all your pictures are identical? Colin Potts |