# Back-projecting Pixel to 3D Rays with an origin different than zero

I am trying to reproject a pixel in a calibrated camera image into a 3D ray. I have found this answer which helped me a lot, and have almost everything running

Back-projecting Pixel to 3D Rays in World Coordinates using PseudoInverse Method

However, for my application it is important to be able to change the starting point of the ray.

In the example above, the starting coordinate t was (0,1,0). I thought I could just change this vector, but changing it also changes the direction of my vector. I would think this is wrong, since the direction of the ray should be the same, regardldess of the starting point. Right?

I have tried multiplying R*t to account for the rotation before applying the translation, but that doesn't seem to work either.

How can I change starting point from (0,1,0) to the correct starting point of my camera

• I don’t understand what you mean by “change the starting point of the ray.” A point in the image is by definition the image of a ray that starts at the camera’s position, which happens to be somewhere other than world-coordinate origin in the example in the linked question. The same algorithm applies regardless of the camera’s position, however. – amd Apr 9 '18 at 20:26
• Thank you amd for your answer. My logic came from the fact that in the projection formula you can set a starting point different than [0,0,0], so I figured I should use that to change the origin of the ray. For some reason I don't understand, this didn't work. What I ended up doing, which worked, was leave these values at the origin and get just the direction of the ray vector. Then I just moved this vector to the position I needed. – Jose Alberto Soler Apr 29 '18 at 10:09