Performing Plane Leveling on Point Clouds

The code shows how to perform plane leveling on point clouds.

C++

#include <eVision/Easy3D/EAffineTransformer.h>
using namespace eVision::Easy3D;

// find the reference plane on the point cloud​
E3DPlane ref_plane;
EPointCloud point_cloud;

// define the ground plane as the plane Z=0​
E3DPlane ground_plane(E3DPlane::ZPlane());

// get the transformation that moves ​
// the reference plane to the ground plane​
E3DTransformMatrix transformation;
transformation = ref_plane.GetTransformationTo(ground_plane);

// apply the transformation to the point cloud​
EAffineTransformer transformer;
transformer.ApplyMatrix(transformation, point_cloud);

C#

using eVision.Easy3D;
// find the reference plane on the point cloud​
E3DPlane ref_plane = new E3DPlane();
EPointCloud point_cloud = new EPointCloud();

// define the ground plane as the plane Z=0​
E3DPlane ground_plane = E3DPlane.ZPlane();

// get the transformation that moves ​
// the reference plane to the ground plane​
E3DTransformMatrix transformation;
transformation = ref_plane.GetTransformationTo(ground_plane);

// apply the transformation to the point cloud​
EAffineTransformer.ApplyMatrix(transformation, point_cloud);

Python

from eVision import Easy3D
# find the reference plane on the point cloud
ref_plane = Easy3D.E3DPlane()
point_cloud = Easy3D.EPointCloud()

# define the ground plane as the plane Z=0
ground_plane = Easy3D.E3DPlane.ZPlane()

# get the transformation that moves
# the reference plane to the ground plane
transformation = ref_plane.GetTransformationTo(ground_plane)

# apply the transformation to the point cloud
Easy3D.EAffineTransformer.ApplyMatrix(transformation, point_cloud)