Problem

Given two images of a soccer ball and homography between the two image planes, check whether the ball is inside the goal (past the goal line).

Solution

The first crucial insight is that to check whether the soccer ball (in midair) is behind or in front of the goal plane, we can find the ball’s projection onto the ground plane (the point right below the ball) and compare it with the goal line.

Then, our scene is the following:

Let be the ball, and be its projections, and be vertical vanishing points. Note that the vanishing points in the image are heavily abstract and are likely off the image or at infinity in an empirical setting.

The lines and are the projection of onto the image planes. If we imagine and casting rays onto in the world, we create two “shadows,” and . The key insight is that the intersection of these shadows gives us the point on the ground plane that’s directly underneath the ball; with , we can compare it with the goal line to see what side it’s on.

We can compute all this on a single image plane; let’s choose the one on the right. We know that the shadow is projected onto , and we want to find the projection of , which we’ll call , onto the right image plane.

However, we also have the homography , and we know is projected onto in the left image plane. Thus, to project onto the right image plane, we have

Then, the projection of onto the right image plane is the intersection of the projection of the two shadows,

With , we can compare it with the goal line in the right image plane to check which side the ball is on.