Setup

My video was taken with a small shipping box on which I marked and circled 35 points. The video was shot on my cell phone camera at 1/4x slow motion and used its built-in stabilization to smooth out small movements that could hamper the tracking (as I found out through earlier, unstabilized videos). The keypoints and 3D points were inputted by hand

Propogating Keypoints

To propogate keypoints, a tracker was created around each 2D point with a bounding box of length 12 surround it. Various trackers were tried, but the cv2.TrackerCRST yielded best results (at the cost of slightly worse performance), which was necessary as dark colored dots on dark colored lines meant that many trackers' points would "slide" up and down the lines as the video progressed.

Homography

The homography matrix was generated off of the following format: with slight modification for 3D; there is a z between each y and 1, and the sequence of zeroes if 4 long. There is also a -u*z item at the end. We solved for h with np.linalg.lstsq

Projection

Finally, with the homography calculated, we only needed to dot it with the 3D points of our cube (a simple length-1 cube starting at (0,0,1). We then used a draw function provided through opencv documentation to overlay the cube onto each frame, combining each frame into a video output at the end. The same was done with the axis. We note that although the homography appears to be very close, but not quite exactly correct, and despite many hours spent on debugging the homography (and reshooting/relabelling videos), I was unable to get a 'perfect' homography.

Link to Lightfield Camera

Link to Image Quilting