This was for my Computer Vision class. This thing was pretty simple once you understood it all.
The cube is drawn in perspective on the chessboard
The hardest part was getting the chessboard pattern even when the tissue was obscuring part of it. That could be solved by finding the closest point from the previous frame, only taking the ones with a certain min distance, and calling cv::solvePnP
on the filtered chessboard pattern.
The next challenge is to do the same thing without the chessboard, but it’s pretty hard. Links for future reference: