Intersection of vector with origin in in image with plane in real world

215 Views Asked by At

I am trying to get the intersection of a direction vector in an image (direction a person is looking), with a plane directly in front and parallel to the image plane actually. Like, where on the wall is this person looking at, is what I am interested in.

I know the position of the camera, the pixel position of the person in the image, and the angle of the head (yaw, pitch, roll) in the image. I can estimate the depth of the person to the plane reasonably as well.

How can I get the intersection of the direction vector with a plane in front of it?

1

There are 1 best solutions below

0
On

Calculate the plane normal of your target plane and calculate the vector projection of the view vector onto the plane normal. Divide the distance from the viewer to the plane by the magnitude of the projected vector. The result of that division will be the magnitude that you need to multiply your view vector by to reach the point of intersection. Not sure if this is the fastest way, but should work.

Although I am pretty sure this is only more intuitive, and not faster than what is described above, an alternate style would be to set the viewpoint and vector as a child to the plane normal vector at some point and then transform that plane normal and point to global origin (positive z axis) (dragging the viewpoint and vector through the transformation). Then divide the z height of the viewpoint by the z component of the view vector to get the magnitude necessary to scale the view vector.