Manually Computing a Perspective Transformation Matrix
While training a Convolutional Neural Network, it might be useful to make it independent of viewpoint from which the scene was captured. Data augmentation can be used to apply different perspective transforms to the input image.
I put together a small python function to manually compute a perspective transform matrix to be applied to an image given rotations (around the z-axis) and (around the x-axis) in the camera frame. You can find it on my github.