E3DMatcher Minimal Sample¶
This code snippet shows how to match a sample with a golden scan reference.
C++¶
#include <eVision/Easy3D/Easy3DMatch/E3DMatcher.h>
using namespace eVision;
using namespace eVision::Easy3D;
// load the reference golden scan and set reference
E3DMatcher matcher;
EPointCloud reference;
float azimuthReference = 0.f, elevationReference = 90.f;
reference.Load("...");
matcher.SetReference(reference, azimuthReference, elevationReference);
// Set thresholds
float distanceThresh = .2f, areaThresh = 1.f;
matcher.SetAnomalyThresholds(EAnomalyThresholds(distanceThresh, areaThresh));
// Prepare data structures (optional)
matcher.PrepareReference();
// load the sample and perform comparison
EPointCloud sample;
float azimuthSample = 0.f, elevationSample = -90.f;
sample.Load("...");
E3DMatch match = matcher.Match(sample, azimuthSample, elevationSample);
std::vector<E3DAnomaly> anomalies = match.GetAnomalies();
//TODO: if (anomalies.size() != 0u): an anomaly was detected: inspect the sample manually? throw it away?
// get cloud to inspect it manually
EPointCloud visualisationCloud;
matcher.GetComparisonPointCloud(visualisationCloud);
C#¶
using eVision.Easy3D;
// load the reference golden scan and set reference
E3DMatcher matcher = new E3DMatcher();
EPointCloud reference = new EPointCloud();
float azimuthReference = 0.0f, elevationReference = 90.0f;
reference.Load("...");
matcher.SetReference(reference, azimuthReference, elevationReference);
// Set thresholds
float distanceThresh = 0.2f, areaThresh = 1.0f;
matcher.AnomalyThresholds = new EAnomalyThresholds(distanceThresh, areaThresh);
// Prepare data structures (optional)
matcher.PrepareReference();
// load the sample and perform comparison
EPointCloud sample = new EPointCloud();
float azimuthSample = 0.0f, elevationSample = -90.0f;
sample.Load("...");
E3DMatch match = matcher.Match(sample, azimuthSample, elevationSample);
E3DAnomaly[] anomalies = match.Anomalies;
//TODO: if (anomalies.Length != 0): an anomaly was detected: inspect the sample manually? throw it away?
// get cloud to inspect it manually
EPointCloud visualisationCloud = new EPointCloud();
matcher.GetComparisonPointCloud(visualisationCloud);
Python¶
from eVision import Easy3D
# load the reference golden scan and set reference
matcher = Easy3D.E3DMatcher()
reference = Easy3D.EPointCloud()
reference.Load("...")
matcher.SetReference(reference, azimuth=0., elevation=90.)
# Set thresholds
matcher.AnomalyThresholds = Easy3D.EAnomalyThresholds(distanceThreshold=0.2, areaThreshold=1.)
# Prepare data structures (optional)
matcher.PrepareReference()
# load the sample and perform comparison
sample = Easy3D.EPointCloud()
sample.Load("...")
match = matcher.Match(sample, azimuth=0., elevation=-90.)
anomalies = match.Anomalies
#TODO: if len(anomalies) != 0: an anomaly was detected: inspect the sample manually? throw it away?
# get cloud to inspect it manually
visualisation_cloud = Easy3D.EPointCloud()
matcher.GetComparisonPointCloud(visualisation_cloud)