Public Member Functions
sal3d::Match3DCoarse Class Reference

Aligns a cop against a given model cop. This class differs from Match3D in that the two COPs don't have to be prealigned. More...

#include <Match3DCoarse.hpp>

List of all members.

Public Member Functions

 Match3DCoarse (const sal3d::COP &cop)
 Creates a new Match3DCoarse with a COP as model.
 Match3DCoarse (const SurfacePoints &points)
 Creates a new Match3DCoarse with a list of points as model.
 Match3DCoarse (const Match3DCoarse &match3d)
 Copy constructor.
 ~Match3DCoarse ()
 Destructor.
Movement3D operator() (const sal3d::COP &cop) const
 Gets the alignment movement for a cloud of points.
Movement3D operator() (const sal3d::COP &cop, float &quality) const
 Gets the alignment movement for a cloud of points, and the quality of the alignment.
Movement3D operator() (const sal3d::COP &cop, const Match3DParameters &params, float &quality, int &iterations) const
 Gets the alignment movement for a cloud of points given some algorithm parameters. It also returns the quality of the alignment and the iterations it took.
Match3DCoarseoperator= (const Match3DCoarse &rhs)
 Copy assignment operator.

Detailed Description

Aligns a cop against a given model cop. This class differs from Match3D in that the two COPs don't have to be prealigned.

It requires linking with match3dcoarse.lib (import library for match3dcoarse.dll).

This class is able to align two COP objects in a “best fit” sense. Given two COP objects, one acting as the model and the other the part to align to the model, this class is able to create a 3D transformation movement (a 4x4 movement) that contains the rotation and translation needed to align both surfaces.

Match3DCoarse uses an iterative algorithm that “moves” the part COP to align in a way that gets closer and closer to the model COP's position and orientation at each iteration. In cases where there are strong simetries within the COP, it may be better to use Match3D if we know that both objects are prealigned, as Match3DCoarse might yield incorrect alignment results.

The 3D transformation movement obtained from aligning the model cop and the part with the Match3DCoarse::operator()() can be used to create a moved part which can then be compared with the model. If we have a ZMap of the model, we can also directly subtract the part using this movement to obtain a comparison measure or disparity map. This disparity map is a point-to-point subtraction between corresponding points of the model and the part.

There is also an overloaded Match3DCoarse::operator()() providing a quality parameter, which is a measure of how good the alignment was between the model and the part. It ranges from 0 to 1, with 0 being a total mismatch and 1 being a perfect alignment.

Match3DCoarse copy constructor does not copy any internal data, it does use reference counting to know how many objects point to the same data. When no object points to this internal data anymore, it gets deleted.

Aligning a COP

Let us assume that we have a function called getCOP() that acquires the COP objects we want to process (namely, the parts). In this example we will use a golden model previously stored on a file, and compare all the acquired COPs with it. To do this we will create a ZMap from the model and compare it with the aligned parts. The result will be passed over to another thread.

 void
 acquireAndCheckParts (const std::string &modelFileName)
 {
     sal3d::COP model(modelFileName);
     sal3d::ZMapFactors zFactors(model.getZMapFactors());
     sal3d::ZMap zModel(model, zFactors);
     sal3d::Match3DCoarse match(model);

     while ( !endProcess() )
     {
         sal3d::COP part(getCOP());
         sal3d::Movement3D alignMatrix(match(part));
         sal3d::ZMap disparityMap(
                         zModel.getDistanceToMovedCOP(part, alignMatrix));
         // Enqueue the disparity map so another thread can process it.
         enqueueDisparityMap(disparityMap);
     }
 }

Constructor & Destructor Documentation

sal3d::Match3DCoarse::Match3DCoarse ( const sal3d::COP cop) [inline, explicit]

Creates a new Match3DCoarse with a COP as model.

Creates a new Match3DCoarse and loads a COP to be used as a model. All subsequent calls to Match3DCoarse::operator() will use the passed cop to compute the alignment. This means that cop should be a cloud of points coming from a golden part or from a CAD design.

Parameters:
[in]copThe cloud of points to be used as model.
Exceptions:
sal3d::ErrorOn Error

References sal3d::COP::c_cop().

sal3d::Match3DCoarse::Match3DCoarse ( const SurfacePoints points) [inline, explicit]

Creates a new Match3DCoarse with a list of points as model.

Creates a new Match3DCoarse and loads a cloud of points to be used as a model. All subsequent calls to Match3DCoarse::operator() will use the passed points to compute the alignment. This means that points should be from a cloud of points taken from a golden part or from a CAD design.

Parameters:
[in]pointsThe list of points to be used as model.
Exceptions:
sal3d::ErrorOn Error
sal3d::Match3DCoarse::Match3DCoarse ( const Match3DCoarse match3d) [inline]

Copy constructor.

Parameters:
[in]match3dThe Match3DCoarse to copy from.

Member Function Documentation

Movement3D sal3d::Match3DCoarse::operator() ( const sal3d::COP cop) const [inline]

Gets the alignment movement for a cloud of points.

Computes the transformation movement that once applied to all 3D points of cop aligns the input cop to the model set in constructor.

Parameters:
[in]copThe cloud of points that is to be aligned with the model stored in this object.
Returns:
The alignment movement for cop.
Exceptions:
sal3d::ErrorOn Error

Referenced by operator()().

Movement3D sal3d::Match3DCoarse::operator() ( const sal3d::COP cop,
float &  quality 
) const [inline]

Gets the alignment movement for a cloud of points, and the quality of the alignment.

Computes the transformation movement that once applied to all 3D points of cop aligns the input cop to the model set in constructor.

Parameters:
[in]copThe cloud of points that is to be aligned with the model stored in this object.
[out]qualityA quality factor ranging from 0 to 1 showing how good the alignment was, being 0 a total mismatch and 1 a perfect alignment.
Returns:
The alignment movement for cop.
Exceptions:
sal3d::ErrorOn Error

References operator()().

Movement3D sal3d::Match3DCoarse::operator() ( const sal3d::COP cop,
const Match3DParameters params,
float &  quality,
int &  iterations 
) const [inline]

Gets the alignment movement for a cloud of points given some algorithm parameters. It also returns the quality of the alignment and the iterations it took.

Computes the transformation movement that once applied to all 3D points of cop aligns the input cop to the model set in constructor. The algorithm is tuned with the given params.

Warning:
Bear in mind that depending on the parameters used the time for the alignment can significantly differ from the default. Be careful with this when using it.
Parameters:
[in]copThe cloud of points that is to be aligned with the model stored in this object.
[in]paramsThe match3d algorithm tuning parameters.
[out]qualityA quality factor ranging from 0 to 1 showing how good the alignment was, being 0 a total mismatch and 1 a perfect alignment.
[out]iterationsThe number of iterations it took for the algorithm to converge and meet the end criteria.
Returns:
The alignment movement for cop.
Exceptions:
sal3d::ErrorOn Error

References sal3d::COP::c_cop(), sal3d::Match3DParameters::extractFeatures, sal3d::Match3DParameters::maxIterations, sal3d::Match3DParameters::maxRotationError, and sal3d::Match3DParameters::maxTranslationError.

Match3DCoarse& sal3d::Match3DCoarse::operator= ( const Match3DCoarse rhs) [inline]

Copy assignment operator.

Parameters:
[in]rhsThe Match3DCoarse to copy to this object.
Returns:
A reference to this object.

The documentation for this class was generated from the following file: