# Unknown depth issue: Triangle, Pyramid, Rotation, Translation, Zoom?

Edit: Had to delete the 2nd picture

Another tricky question. What you can see here is my physical pyramid built with 3 leds which form a triangle in 1 plane and another led in the mid center, about 18mm above the other 3. The 4th one makes the triangle to a pyramid. (You maybe can see it better if you look on the right triangle. This one is rotated about the horizontal axis, and you can see a diode on a stick very well).

The second picture shows my running program. The left box shows the raw picture of the leds (photo with ir-filter). The picture in the center shows that my program found the points and is also able to tell which point is which, based on some conditions (like C is always where the both lines with maximal distance betweens diodes intersect; and the both longest lengths are always a and b). But don't care about this right now, because I know the points are 100% correctly found.

Then on the right picture are some calculated values like the height between C and c and so on. I would be able to calculate more, but I didn't bother for now because I am stuck.

I want to calculate the pyramid's rotation and translation in the 3 dimensional space.

The yellow points are the leds after rotation around an axis through the center of the triangle in camera z- direction. So now I do not have to worry about this when calculating the other 2: the rotation around the horizontal axis and the rotation arround the vertical axis. I could easily calculate these with the distances from the center of the triangle to the 4th diode (as you can see the 4th diode moves on the image plane with rotation), or the lengths of the both axes.

But my problem is the unknown depth.

It affects all lengths (a,b,c, and also the lengths from the center to the 4th diode if we call this d and e). I know the measurements of the real pyramid, with a tolerance of $\pm 5%$% or so, but they get also affected by the zoom. So how do I deal with this?

I thought of an equation with a ratio between something with the lengths of the horizontal axis, the length of the vertical axis, the angles alpha, beta and gamma, and the lengths d and e.

Alpha, beta and gamma only get affected by rotation arround the axes (which I want to know. I want to know the rotation and the zoom), where a rotation arround one axis has the opposite effect than a rotation arround the other. So if you rotate around both axes in the same angle, the ratio between the length of the axes is the same as before.

The zoom (real: how close it is to the camera; what I want to know in 1st place: multiplication factor 2x, 3x,0.5, 0,4322344,.....) does not affect the angles, but all the lengths: a,b,c,d,e,hc (vertical length of axis), hx (i have not calculated it yet, but it would be easy. the name hx can vary, i just thought of something random right now; it is the length of the horizontal axis) in the same way (i guess).

You see I have thought about it a lot, but I think I am too dumb.

So, is there any math genius out there wo can give me the right equations, for either the rotation OR/AND the zoomfactor?

(I also thought about using Posit/Downhill- Simplex, and so on, but this would be the nicest, since i already know so much, like all Points, and so on and so on)

Please, please, I need your help really bad! I am writing this in C++ and with help of OpenCV if you need to know, but i think its more a mathematical problem.