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>
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 ¶ms, 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. | |
| Match3DCoarse & | operator= (const Match3DCoarse &rhs) |
| Copy assignment operator. | |
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.
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); } }
| 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.
| [in] | cop | The cloud of points to be used as model. |
| sal3d::Error | On 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.
| [in] | points | The list of points to be used as model. |
| sal3d::Error | On Error |
| sal3d::Match3DCoarse::Match3DCoarse | ( | const Match3DCoarse & | match3d | ) | [inline] |
Copy constructor.
| [in] | match3d | The Match3DCoarse to copy from. |
| 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.
| [in] | cop | The cloud of points that is to be aligned with the model stored in this object. |
cop.| sal3d::Error | On 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.
| [in] | cop | The cloud of points that is to be aligned with the model stored in this object. |
| [out] | quality | A quality factor ranging from 0 to 1 showing how good the alignment was, being 0 a total mismatch and 1 a perfect alignment. |
cop.| sal3d::Error | On 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.
| [in] | cop | The cloud of points that is to be aligned with the model stored in this object. |
| [in] | params | The match3d algorithm tuning parameters. |
| [out] | quality | A quality factor ranging from 0 to 1 showing how good the alignment was, being 0 a total mismatch and 1 a perfect alignment. |
| [out] | iterations | The number of iterations it took for the algorithm to converge and meet the end criteria. |
cop.| sal3d::Error | On 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.
| [in] | rhs | The Match3DCoarse to copy to this object. |
by
1.7.6.1