Intro: Electronic Rotoscope Animation With Matlab
This Instructable will walk you through the process of rotoscope animation. Rotoscope animation is an extremely time intensive technique that relies on artists tracing over every frame of a live action film to generate an animated video. Traditionally, this technique relied on a machine called a rotoscope which projected a video onto a transparent easel that an artist would use to trace the still frames onto paper or another medium. Modern rotoscoping is usually completely digital, with the projector/easel machine being replaced by software. This animation technique has been used since its invention in 1917 for a wide range of genres from fully animated movies such as Snow White, to partially animated videos such as a-ha's music video for the song "Take On Me," to special effects in otherwise live-action movies such as the lightsabers in the original Star Wars trilogy. Today, rotoscoping is often used to assist special effects artists. For example, the movie X-Men: Apocalypse mentions 40 rotoscope artists in their end credits. To follow this Instructable, you only need a copy of MATLAB, (or some other way of extracting images to video) and an image editor of your choice. Depending on the length of the animation and the detail you intend to put into it, this procedure may take from a few minutes to a few days. Artists of any skill level should be able to follow this instructable.
Step 1: Finding a Video
The first step in rotoscoping is finding a video to draw over. The simplest way to do this is to make the video yourself with a video camera and upload it to a computer, but this may not be feasible if the subject is large or you don't have access to it (the space shuttle, or a volcano for example). If you cannot film the video yourself, you will need to find it online and download it. There are some video hosting websites that allow content to be downloaded directly to your computer as MP4s, (Vimeo for example) but if the video you want to use is on a website like Youtube that doesn't support direct downloads of videos, you can still use the service at clipconverter.cc to download the video.
Step 2: Convert the Video File to Image Files Using Matlab
Once you have the video you want to use, the content must be converted from a composite video to a set of images. There are several ways to accomplish this, we will be using a Matlab function called VideoReader. VideoReader constructs a video object that can read in data to Matlab. We can then use Matlab to display or save still frames from the video. In the following code, we use a while loop to extract frames from the video. Although we can extract as many frames as the source video contains, we limit the program to only save every sixth frame. Because the original video is at 60 frames per second, extracting every sixth frame will cut the animation to 10 frames per second. 10 fps is fast enough so the eye can tell what is going on, but slow enough so that we don't have to spend so much time drawing all of the frames.
<p>diceVideo=VideoReader('C:\Users\Sam\Desktop\dice\original\dice.avi');</p><p>i = 1; while hasFrame(diceVideo) img = readFrame(diceVideo); filename = [sprintf('%03d',i) '.jpg']; fullname = fullfile('C:\Users\Sam\Desktop\dice\images',filename); if mod(i,6)==0 imwrite(img,fullname) end i = i+1; end</p>
To use this code, the video address and the address of the folder where you want the images to be dumped should be changed to your own folders.
Caution: Running this program may delete any files that you have in your images folder. If your files are deleted, they will not be recoverable.
Step 3: Tracing Over the Image
At this point, you should have a set of images ready to be traced. Tracing is the longest step of the process, but there are tricks and design decisions to be made that can decrease the amount of time spent on each frame.
For this step, you will need an image editor. For the most part, any image editor will do, however, to make this step easier you should use one that supports layers. Layers will allow you to trace on top of the image without disturbing the original image. The program I am using is free editing software called Paint.net.
To start, you should open the image and add a new layer to the file. Once the layer is added, trace the shape of the object you want to draw onto the new layer. Once you are done, you can delete the original and save the new layer as an image.
If you have a static background, you may want to copy/paste it onto every image before you start tracing.
Step 4: Coloring/Shading the Object
At this point, you may want to fill in the black and white object that has been animated. This step can take significantly less time than tracing by utilizing the fill tool. During this step you should open every frame of the animation and fill in the shapes with whatever color is appropriate. If the animation has to be shaded, this is the time to do it.
Step 5: Finishing Touches
Often times, rotoscoped animations are purposely made to be stylized to cover errors/poorly detailed frames of the animation. This step can save time and add character to your animation. Stylized effects can include blurring, movement lines, and shockwaves.
Step 6: Recompile the Images Into an Animation
In the second step, we needed to write our own program because good, free tools do not exist to turn video into images. Tools do exist, however, to turn images back into video. Imgflip.com has a great tool for turning images into gifs. Simply go to imgflip.com, and select "Make a GIF (from images)" under the "Create" tab. Select "Upload Images," navigate to your image folder, and shift-select all of the images that you want to be in the animation. Imgflip will automatically arrange the images, or you can arrange them yourself. From here, you can change things like the speed of the frames, the quality and size of the gif, and other useful settings like rotation, and cropping. Once you are done with the settings, simply click, "Generate GIF" and download the file.
Step 7: The Finished Product
This is the finished product. I have spliced together unedited, shaded, and black/white animation to show how each step relates to the previous one. At this point, you should have a smooth, lifelike animation of your subject. If you don't, then your animation may be suffering from an effect called "boiling." Boiling happens when a rotoscope artist does not correctly trace the object, causing frames to not match up with previous or subsequent frames. Boiling makes the animation look jittery and is generally not pleasant to watch. Fixing this often requires a redraw of the subject.
I hope you learned a lot, and thank you for reading this Instructable.