I am currently working on an application that allows to make 3D measurements directly on 2D views. As I am working, I want to create a virtual camera that will create new views between the position of my calibrated images.
The solution I'm currently working on is to take the nearest image and rotate it using an homography
matrix. I know it isn't the best solution, as I am losing the depth of the object, but for the 1st version, it is the easiest solution.
Thus, I have a sphere of images around one object. This is a picture from a calibrated camera :
And this is a plot with a calibrated camera (and it's axes), the orange point, and the position of the hypothetical camera (the purple point) :
I'm assuming that the picture is on a plane facing the calibrated camera (the top view) and center at the origin.
To create the homography matrix, I choose 4 arbitrary pixel points on the calibrate picture (because I'm assuming that they point to the same plane), get the intersection of each of their rays to the plane (thus 3d points) and I want to project those 4 3d points on the hypothetical camera (needing its hypothetical calibration) to get 4 pixel point correspondences.
To make it easier, we can assume 2 things :
- there won't be any rotation on the Z axis. The only rotations needed are the ones changing the direction of the camera
- the camera should be directed to the exact same 3d point (the center of the calibrated image should stay at the center of the new image) to make sure that the image is still displayed after its rotation and translation.
To summary a bit, usually, using the homography we go from a picture to the top view of the surface we wanna see. In this case, we come from the top view to a rotated picture that we need to figure out.
As I have a rotation matrix I already tried to simply rotate it depending on my position on the "sphere". It doesn't work well and if the hypothetical is really far away from the calibrated camera, there is a big risk that the object won't even be displayed. (that's why I want to add the constraint that the center point has to be the same)