Capturing data
First, we need to create an app for a mobile device that can capture both images and gyroscope signals simultaneously. Interestingly, these aren't readily available (at least on Android).
Once we have a video and gyro stream, we'll look at how to use that data.
Create a standard Android application (I use Android Studio). We'll start by creating a blank application. The goal is to create a simple app that starts recording video and gyro signals on touching the screen. On touching again, the recording stops and a video file and a text file are saved on the phone. These two files can then be used by OpenCV to compute the best stabilization.
Note
Code in this section is available in the GitHub repository for this book: https://github.com/OpenCVBlueprints/OpenCVBlueprints/tree/master/chapter_7
Recording video
We'll start by implementing a simple video recording utility. Create a new blank project in Android Studio (I named it GyroRecorder and named the activity Recorder). First, we...