Aligns a cop against a given model cop. This class differs from Match3DCoarse in that the COPs have to be prealigned within a certain tolerancy for the alignment to be successful. More...
#include <Match3D.hpp>
Public Member Functions | |
| Match3D (const sal3d::COP &cop) | |
| Creates a new Match3D with a COP as model. | |
| Match3D (const SurfacePoints &points) | |
| Creates a new Match3D with a list of points as model. | |
| Match3D (const Match3D &match3d) | |
| Copy constructor. | |
| ~Match3D () | |
| 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. | |
| Movement3D | operator() (const sal3d::COP &cop, const Movement3D &prealign) const |
| Gets the alignment movement for a pre-aligned cloud of points. | |
| Movement3D | operator() (const sal3d::COP &cop, const Movement3D &prealign, float &quality) const |
| Gets the alignment movement for a pre-aligned cloud of points, and the quality of the alignment. | |
| Movement3D | operator() (const sal3d::COP &cop, const Movement3D &prealign, const Match3DParameters ¶ms, float &quality, int &iterations) const |
| Gets the alignment movement for a pre-aligned cloud of points given some algorithm parameters. It also returns the quality of the alignment and the iterations it took. | |
| Match3D & | operator= (const Match3D &rhs) |
| Copy assignment operator. | |
Aligns a cop against a given model cop. This class differs from Match3DCoarse in that the COPs have to be prealigned within a certain tolerancy for the alignment to be successful.
This class requires linking with match3d.lib (import library for match3d.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 matrix) that contains the rotation and translation needed to align both surfaces.
Match3D 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. This algorithm can be applied to accurately align COPs given an acceptably small initial misalignment, tipically ±10 degrees in any of the three axis (X, Y, and Z.)
The 3D transformation movement obtained from aligning the model cop and the part with the Match3D::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 Match3D::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.
Match3D 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::Match3D 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::Match3D::Match3D | ( | const sal3d::COP & | cop | ) | [inline, explicit] |
Creates a new Match3D with a COP as model.
Creates a new Match3D and loads a COP to be used as a model. All subsequent calls to Match3D::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::Match3D::Match3D | ( | const SurfacePoints & | points | ) | [inline, explicit] |
Creates a new Match3D with a list of points as model.
Creates a new Match3D and loads a cloud of points to be used as a model. All subsequent calls to Match3D::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::Match3D::Match3D | ( | const Match3D & | match3d | ) | [inline] |
Copy constructor.
| [in] | match3d | The Match3D to copy from. |
| Movement3D sal3d::Match3D::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::Match3D::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::Match3D::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.
| Movement3D sal3d::Match3D::operator() | ( | const sal3d::COP & | cop, |
| const Movement3D & | prealign | ||
| ) | const [inline] |
Gets the alignment movement for a pre-aligned 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. The movement matrix passed to it is used to pre-align the part to make the matching easier.
| [in] | cop | The cloud of points that is to be aligned with the model stored in this object. |
| [in] | prealign | The movement to be applied to the supplied cop before aligning. |
cop.| sal3d::Error | On Error |
References operator()().
| Movement3D sal3d::Match3D::operator() | ( | const sal3d::COP & | cop, |
| const Movement3D & | prealign, | ||
| float & | quality | ||
| ) | const [inline] |
Gets the alignment movement for a pre-aligned 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. The movement matrix passed to it is used to pre-align the part to make the matching easier.
| [in] | cop | The cloud of points that is to be aligned with the model stored in this object. |
| [in] | prealign | The movement to be applied to the supplied cop before aligning. |
| [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::Match3D::operator() | ( | const sal3d::COP & | cop, |
| const Movement3D & | prealign, | ||
| const Match3DParameters & | params, | ||
| float & | quality, | ||
| int & | iterations | ||
| ) | const [inline] |
Gets the alignment movement for a pre-aligned 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 movement matrix passed to it is used to pre-align the part to make the matching easier. 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] | prealign | The movement to be applied to the supplied cop before aligning. |
| [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::Movement3D::c_movement_3d(), sal3d::Match3DParameters::extractFeatures, sal3d::Match3DParameters::maxIterations, sal3d::Match3DParameters::maxRotationError, and sal3d::Match3DParameters::maxTranslationError.
Copy assignment operator.
| [in] | rhs | The Match3D to copy to this object. |
by
1.7.6.1