I am using a camera to track a robot. The equation below, from OpenCV, gives an equation for finding pixel coordinates from 3D coordinates. I want to do the reverse. I know that usually this would be impossible as any pixel represents a line of infinite 3D points. However, I know that the robot will always have a constant height (z = 350 mm always). Therefore, I believe it is possible to find the x and y coordinates from pixel coordinates.
From observation it appears that even using the equation as intended map 3D points to pixel coordinates is impossible, as performing the matrix multiplication would yield a 4x1 column vector, so how could those values be mapped to the pixel coordinates, a 3x1 column vector?
The equation provided is:
$$ \left(\begin{matrix} u& \\ v&\\ 1& \end{matrix}\right) = \left(\begin{matrix} f_x& 0& c_x& \\ 0& f_y & cy& \\ 0& 0& 1& \end{matrix}\right) \left(\begin{matrix} r1& r2& r3& tx& \\ r4& r5& r6& ty& \\ r7& r8& r9& tz& \end{matrix}\right) \left(\begin{matrix} x&\\ y&\\ 350&\\ 1& \end{matrix}\right) $$
Where u and v are known pixel coordinates, and fx, fy, cx, cy; all rotation (r(1...9); and translation t(x,y,z) values are known.
However, because the rotation translation matrix is not square, I cannot find the inverse to solve the simultaneous equation. I have seen that I can add a row of zeros, ending with a 1 to it. And add a row and column and zeros to the 3x3 matrix. Is this allowed?
Such that the equation becomes:
$$ \left(\begin{matrix} u& \\ v&\\ 1& \end{matrix}\right) = \left(\begin{matrix} f_x& 0& c_x& 0& \\ 0& f_y & cy& 0&\\ 0& 0& 1& 0& \\ 0& 0& 0& 1& \end{matrix}\right) \left(\begin{matrix} r1& r2& r3& tx& \\ r4& r5& r6& ty& \\ r7& r8& r9& tz& \\ 0& 0& 0& 1& \end{matrix}\right) \left(\begin{matrix} x&\\ y&\\ 350&\\ 1& \end{matrix}\right) $$
However, now if I were to perform the matrix multiplication, or find the inverse matrices and rearrange the to find x and y, it appears that the system is over-defined.
My question: Is adding the rows and columns viable, and what would I have to add to the 3x1 pixel coordinates column vector for the matrix multiplication to be valid? Is what I am attempting even possible?
Thank you very much for your help.