Computer Vision – Pinhole Camera Projection of Rectangle to Axes-Aligned Image

computer visiongeometrylinear algebra

I have a situation where I want to take a rectangle in a pin hole camera view and find which the possible corresponding rectangles in 3D space are.

Own work:

My intuition tells me that the set of possible rectangles in the 3D space shall be so that the corner points are parametrized like so:

$(x_k,y_k,1) t_k$

Furthermore, we know that pairwisely $x_1=x_2, x_3=x_4, y_1=y_3, y_2=y_4$, in other words we can reduce down to two points $(x_1,y_1)$ and $(x_4,y_4)$, furthermore we can assume that these are all known.

The plane equation $ax+by+cz + d = 0$ gives 4 parameters a,b,c,d which the parametrized points above need to satisfy.

Now, we can express $t_k\cdot (ax_k+by_k+c) + d = 0$

The problem here is… that this is linear in $t_k$ and in $a,b,c,d$ but separately. Also we have $8$ unknowns and $4$ equations.

Now… for the points to just lie on the same plane is not a condition strong enough. It does not guarantee that the four points will be corners to a rectangle there.

Scalar product of pairwise vectors in 3D space shall be 0. We can express conditions such as :
$[x_2t_2-x_1t_1,y_2t_2-y_1t_1,t_2-t_1] \cdot [x_3t_3-x_1t_1,y_3t_3-y_1t_1,t_3-t_1] = 0$

$t_1,t_2,t_3$ will be related by this.

If I am not mistaken it will be a quadratic form which we can seek a null space for. This null space when found will tie a linear scaling of $t_1,t_2,t_3$ to a common parameter, or possible several if the space is bigger than 1 dimension.

But perhaps this procedure will be unnecessarily complicated?

I would like to show something of the sort that a necessary selection of $t_1,t_2,t_3,t_4$ needs to be such that the vectors mentioned at the earliest are all of equal norm. But I am not sure if that is true and if so how to show it.

Best Answer

Since you are using a pinhole camera, if you view an object that is a perfect rectangle in a plane and the image plane is not parallel to that rectangle, the image will have a “vanishing point” for at least two sides of the rectangle, that is, those sides will not be parallel in the image.

Since you have indicated that both the object you view and its image must be rectangles, the object must be parallel to the image plane.

This implies that all four of your $t$ values must be equal.

Simply select a plane parallel to the image plane and project the image to that plane to find a possible set of coordinates for the object.

Related Question