In my last post, I was able to direct a movie fight scene using webcams at 0 degrees, 90 degrees, 180 degrees and 270 degrees.
In this post I will direct a killer robot scene with the following camera angles:
As you can see, we have 4 webcams plugged into a single PC. One at ground level:
One from above:
One from the side:
And one from a railway track:
I can push the toy train along the track and the camera will pan across the scene as it unfolds!
Let’s take a peek at what each camera can see. Here’s a shot from the ground level camera:
A shot from the camera above:
A shot from the camera at the side:
And a shot from the railway tracks:
Okay, so we are ready to film the killer robot scene. My post Camera angles with OpenCV explains how to use OpenCV to capture frames from each of the 4 webcams simultaneously. As each frame is captured, we can save it to disk e.g.
Great, we have the killer robot scene filmed from 4 angles: ground, above, side and track.
Now I can use the code in my last post Be a Movie Director using Python to replay the scene. Google Speech Recognition uses the words I utter into my computer microphone to cut between camera angles. Take a look as the robot terrorizes Lego policemen at a woodland hospital:
As the director, I say “above” and the camera angle cuts to a bird’s-eye view. Next, I say “side” and the camera angle cuts to a side shot. Finally, I say “track” and the camera angle cuts to a panning shot courtesy of the railway track.
I’ve shot the scene in slow-mo with the following OpenCV function:
The video above then shows the whole scene from each camera angle, at a normal speed of cv2.waitKey(35)
So there you have it – with a bit of Python code and 4 webcams we can direct a movie from multiple camera angles. Next up, let’s try using OpenCV computer vision and OpenGL graphics library to create some special effects!
To avoid frame lag when reading frames from a webcam, employ a thread. The Webcam class on GitHub – which is part of the SaltwashAR Python Augmented Reality application – is an example of reading a webcam frame from within a thread.