1 | initial version |
You seem to have a fundamental understanding of how solvePnP works. HERE is a tutorial that should explain things better. In short, you have both your imagePoints and your worldPoints coming from the same place. They're actually the same numbers. That can't work.
Your image points are correct. The location in pixels inside the image.
Your world points should be the actual corners of the table. So for a pretend table that is 1x2 meters, you have [0,0,0], [1,0,0], [0,2,0],[1,2,0]. And then you need to make the order of your image points and world points match. In otherwords, the point in image space that represents the corner you called [0,0,0] is always paired with the pixel coordinates of that corner.
Lastly, and least important, you don't have enough point to use RANSAC. Just use solvePnP with the SOLVEPNP_P3P flag.