E3DAligner Reprojection Plane¶
This code snippet shows how to set the reprojection plane when performing alignment.
C++¶
#include <eVision/Easy3D/Easy3DMatch/E3DAligner.h>
using namespace eVision;
// load the reference mesh and define the pose
Easy3D::E3DAligner aligner;
Easy3D::EMesh cad;
cad.Load("...");
float azimuthReference = 0.f, elevationReference = 90.f;
aligner.SetReference(cad, azimuthReference, elevationReference);
// define the reprojection plane
bool userKnowsPlaneEquation = false; // depending on the user
if (userKnowsPlaneEquation)
{
Easy3D::E3DPlane reprojectionPlane(Easy3D::E3DPoint(0, 0, -1), -15);
aligner.SetScanReprojectionPlane(reprojectionPlane);
}
else
{
Easy3D::EPointCloud cloud;
cloud.Load("...");
bool objectAbovePlane = true; // is the object above the plane on the cloud
aligner.SetFlatScan(cloud, objectAbovePlane);
}
// load the sample
Easy3D::EPointCloud sample;
sample.Load("...");
float azimuthSample = 0.f, elevationSample = 90.f;
// perform alignment
Easy3D::E3DAlignment alignment = aligner.Align(sample, azimuthSample, elevationSample);
C#¶
using eVision.Easy3D;
// load the reference mesh and define the pose
E3DAligner aligner = new E3DAligner();
EMesh cad = new EMesh();
cad.Load("...");
float azimuthReference = 0.0f, elevationReference = 90.0f;
aligner.SetReference(cad, azimuthReference, elevationReference);
// define the reprojection plane
bool userKnowsPlaneEquation = false; // depending on the user
if (userKnowsPlaneEquation)
{
E3DPlane reprojectionPlane = new E3DPlane(new E3DPoint(0, 0, -1), -15);
aligner.ScanReprojectionPlane = reprojectionPlane;
}
else
{
EPointCloud cloud = new EPointCloud();
cloud.Load("...");
bool objectAbovePlane = true; // is the object above the plane on the cloud
aligner.SetFlatScan(cloud, objectAbovePlane);
}
// load the sample
EPointCloud sample = new EPointCloud();
sample.Load("...");
float azimuthSample = 0.0f, elevationSample = 90.0f;
// perform alignment
E3DAlignment alignment = aligner.Align(sample, azimuthSample, elevationSample);
Python¶
from eVision import Easy3D
# load the reference mesh and define the pose
aligner = Easy3D.E3DAligner()
cad = Easy3D.EMesh()
cad.Load("...")
aligner.SetReference(cad, azimuth=0., elevation=90.)
# define the reprojection plane
user_knows_plane_equation = False # depending on the user
if user_knows_plane_equation:
reprojectionPlane = Easy3D.E3DPlane(Easy3D.E3DPoint(0, 0, -1), -15)
aligner.ScanReprojectionPlane = reprojectionPlane
else:
cloud = Easy3D.EPointCloud()
cloud.Load("...")
object_above_plane = True # is the object above the plane on the cloud
aligner.SetFlatScan(cloud, object_above_plane)
# load the sample
sample = Easy3D.EPointCloud()
sample.Load("...")
# perform alignment
alignment = aligner.Align(sample, azimuth = 0., elevation= 90.)