Obtain 3D coordinates from various XZ coordinate pairs

67 Views Asked by At

This is going to be my first question on this forum, I'll try to be as clear as possible!

The problem starts narrating that I am interested on obtaining the 3D coordinates of 50 points on a cylinder. For this, I have taken a picture of the cylinder as if standing on the Y axis of the following diagram:

View of the XYZ axis, photo is taken as if standing on Y axis

I take one picture, then rotate the cylinder $\theta_1$ degrees and take another, then rotate again $\theta_2$ degrees and repeat. I manage to take 50 pictures.

My problem starts when I try to solve it using linear algebra. So far I have two matrices $\mathbf{X}_{50\times50}$ and $\mathbf{Z}_{50\times50}$ and I also have a $\mathbf{\Theta}_{50\times1}$ matrix where I have stored the angles (which are given to me). They ask me to obtain the original XYZ coordinates from all the given information.

As I understand it, the projection of an original XYZ coordinate $(x_i, y_i, z_i)$ onto the XZ plane can be given by the following: $$\begin{pmatrix} x^{'}_{1} \\ z^{'}_{1} \\ \end{pmatrix} = \begin{pmatrix} x_{1} \\ y_{1} \\ z_{1} \\ \end{pmatrix} \begin{pmatrix} \cos(\theta) & -\sin(\theta) & 0 \\ \sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1 \\ \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{pmatrix}$$

I understand the I have to rotate and then project (otherwise i'd be losing information). I know this system can be solved using least squares ($Ax=b$) where $A$ would be a combination of the Rotation and Projection matrix, something like :

$$A = \begin{pmatrix} \mathbf{PR_{\theta_1}} & \mathbf{0}_{2x3} & \cdots & \cdots &\mathbf{0}_{2x3} \\ \mathbf{0}_{2x3} & \mathbf{PR_{\theta_2}} & \mathbf{0}_{2x3} & \cdots & \vdots\\ \vdots & \mathbf{0}_{2x3} & \ddots & & \vdots \\ \vdots & \vdots & & & \vdots \\ \mathbf{0}_{2x3} & \cdots & \cdots & \cdots & \mathbf{PR_{\theta_{50}}}\\ \end{pmatrix}$$

But once I solve that system, I obtain a solution matrix that has 50 different XYZ points for one angle, then another 50 different XYZ points for another angle, and that's where I don't really know what to do.

I'd really appreciate any advice, even if it implies starting over! Thanks in advance everyone.

EDIT: I apologize if I've broken any specific format rules or otherwise, I'm new to this forum and come from a very poor maths background.

EDIT2: I'll try to explain the process a bit better:

I take a picture of the XZ plane as if I was standing on the Y axis, so each one of the 3D points in the XYZ space gets projected onto the XZ plane with coordinates $x^{'}_{1}$ and $z^{'}_{1}$. Afterwards, there is a rotation of the cylinder around the Z-axis, with angle $\theta_1$. I take another picture, and obtain a different set of (x', z') coordinates. I do this for the 50 theta angles.