Planar and Spherical Projections of a Point Cloud (Using Open3D)
By: Aashutosh Pyakurel
Tags: Geometry, Numpy, Python, Python3, Open3d

April 29, 2020

A point cloud is a collection of points in 3-dimensional coordinate space represented by x, y, and z axes. These points may just form a geometric shape or more complex structures such as a 3-dimensional representation of the real world. Various libraries, even with open-sources, such as the Point Cloud Library (PCL) and Intel’s Open3D, provide native datatype for a point cloud. These libraries not only allow simple geometric transformations of the cloud but also provide sophisticated functionalities such as the reconstruction of a 3D scene from various images.

However, this article discusses a simple geometric approach to achieve the reverse of 3D reconstruction, i.e generate an image from a point cloud. We will also see how to project the point cloud onto other non-planar geometries such as a sphere. Hence, our objective is the following

Project a point cloud from a certain perspective to a given plane, then store the projection as an image; and

Project the point cloud onto the surface of a given sphere.

The sample implementation included in this article was run in python3.6. The following additional libraries for python must be available

Open3D (tested with v0.9)

NumPy

Projection onto a Plane

We will try to achieve the perspective projection of a point cloud (i.e. from a fixed optical center) onto a plane given by the general equation:

The above demonstration shows the perspective transform of a set of points onto the plane P from the optical center of the camera, with arbitrary co-ordinates (x₀, y₀, z₀). We can see that the projection (x, y, z)of a point (x₁, y₁, z₁) on the plane P is nothing but the point of intersection between the said plane and a line L passing through the optical center and the given point in the cloud.

The line L in 3-dimensional space can be represented as follows

where a, b and c are the direction cosines of the line L, and t is known as the direction ratio.

With the given optical center and the set of points in the cloud, we can compute the direction cosines for the lines passing through each of the points.

We can substitute the equations of the line in the equation of the plane P since we are solving for the point of intersection between the two.

Solving for t, we can deduce the above equation as follows

Finally, we can obtain the projection by substituting the value of t into the equations of the line L.

The above computation should be performed for each point in the Point Cloud to obtain the complete projection on the given plane.

Python Implementation

The following function takes an Open3D PointCloud, equation of a plane (A, B, C, and D) and the optical center and returns a planar Open3D PointCloud Geometry.

Output

The resulting planar Point Cloud can be seen as follows

Projection onto a Sphere

A Point Cloud maybe projected onto geometrical surfaces other than a plane, such as a sphere. The spherical projection in particular maybe used to approximate a 360 image of the Point Cloud since those are spherical or cylindrical photographs of a scene.

The figure above shows the spherical projection of a point onto the surface of a sphere with radius r₁ and with its center at the point(x₀, y₀ , z₀). Such a sphere can be represented by the following equation

Similar to the projection on a plane, the spherical projection of a point is the point of intersection between the given sphere S and the line passing through the center of the sphere and the point.

Again, the line L in 3-dimensional space can be represented as follows

where a, b and c are the direction cosines of the line, and t is the direction ratio. With the given center of the sphere and the set of points in the cloud, we can compute the direction cosines for the lines passing through each of the points and the center.

Here,

is the distance between the center of the sphere and the point in the Point Cloud.

Now, we can substitute the equations of the line into the equations of the sphere to solve for t.

Solving this equation for t, we obtain the following relation.

Finally, substituting this value of t and the direction cosines into the equations of the line, we can obtain the projected points.

or,

Python Implementation

The following python method takes an Open3D PointCloud geometry, and the radius and center of the sphere to project on.

Output

The resulting spherical projection of the cloud is as follows

References

The point of intersection between a line and a plane. http://www.ambrsoft.com/TrigoCalc/Plan3D/PlaneLineIntersection_.htm

Aashutosh is an engineer currently researching and engineering at Ekbana.