I have a 3D point (xw,yw,zw) with normals (Xn,Yn,Zn), with the intrinsic matrix I can project it to image space (xi,yi). I want to calculate a homography matrix such that I know how the 2D feature around xi,yi looks like when it is located at the center of the image, as well as correcting any perspective error and here is my approach:
First I calculate the 3x3 rotation matrix (R) to transform Xn,Yn,Zn to 0,0,1 so that the 3D normals is facing towards the camera. Then I come out with this equation.
image width / 2 r11 r12 tx
image height /2 = intrinsic matrix * r21 r22 ty * intrinsic matrix.inverse()
1 r31 r32 tz
r11,r12,r21,r22,r31,r32 comes from the R rotation matrix, i know the intrinsic matrix and the image size, so all I have to do is to solve for tx,ty,tz. After solving it the right side of the equation will be my homography matrix.
Just wondering if this is a correct approach?