Adding Alice characters to real life movies
It is easy to delete the ground in an Alice world. Right click on the ground in the object
tree and click delete.
Once the ground is deleted the world will look like this:
Next you need to set the background color to green for the world instead of blue. To do this
click on the World in the object tree and then on the Properties tab. Change the Atmosphere
Color to green.
Now the background will be green.
Now you want to play the Alice movie but then click on Pause to stop it so that we can specify
the region to capture.
Open DrJava and open MovieCapturePanel.java. Click on Run to run the main in this class.
This will ask you for a directory to write the JPEG frames to. Enter the full path for
the directory. Be sure to either use a forward slash '/' or two backward slashes '\\' since
Java uses the backward slash to indicate a special character.
The Frame-based Movie Capturer window will appear. Click on the Capture Screen button to
capture the whole screen and show it scaled smaller in the Frame-based Movie Capturer window. The default
is to capture 16 frames per second but you can select 24 or 30 in the Frame-based Movie Capturer window.
Now click on the Pick Region button and click the top left area to capture and drag to the bottom right
area to capture. The region will be shown in a rectangle. If you don't like the selected region you can click the Pick Region button again and try again.
Now click the Start Capture button in the Frame-based Movie Capturer window to start capturing the frames to the directory. Go back to the Alice movie and click the Restart button to start the Alice movie over from the beginning.
When the Alice movie is finished with the part you want to capture click the Stop Capture button on the Frame-based
Movie Capturer window. You can click the Play Movie button on the Frame-based Movie Capturer window to see the movie you have captured. You can use the Prev and Next buttons on the Movie Player to see which frames you need to delete since you had to restart the Alice movie. The frame number is shown at the top of the Movie Player.
Open the directory and delete any extra frames (you may need to delete the last one as well since it
often is not complete). You can run the MoviePlayer class and select the directory that has the frames in it to check it again.
Now you are ready to merge the Alice frames with live action frames. You can do this in the MovieMaker class. See
program 137 on page 495 in the Introduction to Computing and Programming with Java: A Multimedia Approach for ideas on
how to process all the frames of a movie. You may want to create a different type of chromakey method that copies only
the non-green pixels to another picture. Here is the sort of result you can get:
chickenDance1.mov as Quicktime
Save this file to your windows machine and open it.
You can create a Quicktime or AVI movie from a directory of JPG frames using MovieWriter.java in the most recent version of bookclasses. Right now the AVI movie is much bigger than the Quicktime movie.
If you run out of memory while processing movies increase the allowed amount in DrJava by clicking on Edit then Preferences. Click on Miscellaneous and enter -Xmx512m -Xms128m to set the max to 512 MB and the starting memory to 128MB.
Or if you are using the jdk use
java -Xmx512m -Xms128m ClassName
Alice movies are 800 by 600 and many pictures are 640 by 480. If you want to scale your Alice pictures you can use the scale method in the Picture class to scale it by 0.8 in x and y. This method creates a new picture of the scaled
Picture p = new Picture("origAlicePicturePath.jpg");
Picture p2 = p.scale(0.8,0.8);