The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1
Chapter 8 The Raspberry Pi Camera Module 207

THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE


though, Python runs whatever code is inside – in this case, code telling it to stop the camera
preview and exit cleanly.
Now you’re ready to start capturing your stop-motion animation! Position the Camera
Module where it can see the objects you’re going to animate, and make sure it won’t move –
if the camera moves, it spoils the effect. Place your objects in their starting positions, then
click Run to launch your program. Check everything looks good in the preview, and press the
push-button to capture your first frame.
Move the objects slightly – the less you move them between frames, the smoother the
finished animation will be – and press the push-button again to capture another frame. Keep
doing this until your animation is finished: the more frames you capture, the longer your
animation will be.
When you’ve finished, press CTRL+C to close your program, then double-click on the
animation folder on the desktop to see the pictures you’ve captured (Figure 8-11). Double-
click on any picture to open it and see it in more detail!


5 Figure 8-11: The captured images in the folder


At the moment, though, all you have is a folder full of still images. To create an animation,
you need to turn them into a video. To do so, click on the raspberry icon to load the menu,
choose Accessories, and click on Terminal. This opens a command-line interface, discussed in
more detail in Appendix C, which allows you to type commands to the Pi. When the Terminal
loads, start by changing into the folder you made by typing:


cd Desktop/animation

It’s important that the ‘D’ of ‘Desktop’ is in upper-case; Raspbian is what is known as case-
sensitive, which means if you don’t type a command or folder name exactly as it was originally
written, it won’t work! Once you’ve changed folders, type the following:

Free download pdf