Implementing the demo application
We are going to implement our demo in a single script, ImageTrackingDemo.py
, which will contain the following components:
- Import statements
- A helper function for a custom grayscale conversion
- Helper functions to convert keypoints from 2D to 3D space
- An application class,
ImageTrackingDemo
, which will encapsulate a model of the camera and lens, a model of the reference image, a Kalman filter, 6DOF tracking results (including the translation and both the Rodrigues and Euler representations of the rotation), and an application loop that will track the image and draw a simple AR visualization - A
main
function to launch the application
The script will depend on one other file, reference_image.png
, which will represent the image that we want to track.
By preparing a reference image in advance, and by loading it from file at runtime, we can ensure that its technical qualities are good: it has a high resolution (important for close-up tracking), it is properly...