Added RegistrationVis tests

This commit is contained in:
matlabbe
2026-05-17 22:51:46 -07:00
parent da27557787
commit 5959fe3505
5 changed files with 662 additions and 25 deletions
+35 -21
View File
@@ -31,6 +31,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace rtabmap {
/**
* @class RegistrationInfo
* @brief Statistics and diagnostics returned by @ref Registration.
*
* Filled by @ref RegistrationVis and/or @ref RegistrationIcp during
* @ref Registration::computeTransformation(). The 6×6 @ref covariance matrix
* is clamped to @ref Registration::COVARIANCE_LINEAR_EPSILON and
* @ref Registration::COVARIANCE_ANGULAR_EPSILON on the diagonal when empty or
* too small.
*
* Visual fields are set by @ref RegistrationVis; ICP fields by @ref RegistrationIcp.
* In a combined Vis+ICP pipeline, both sets may be populated in the same object.
*/
class RegistrationInfo
{
public:
@@ -53,6 +66,7 @@ public:
{
}
/** @brief Copies scalar metrics and @ref covariance; omits correspondence ID vectors. */
RegistrationInfo copyWithoutData() const
{
RegistrationInfo output;
@@ -76,31 +90,31 @@ public:
return output;
}
cv::Mat covariance;
std::string rejectedMsg;
double totalTime;
cv::Mat covariance; /**< 6×6 registration uncertainty (CV_64FC1). */
std::string rejectedMsg; /**< Reason the registration was rejected, if any. */
double totalTime; /**< Total registration time (seconds). */
// RegistrationVis
int inliers;
float inliersRatio;
float inliersMeanDistance;
float inliersDistribution;
std::vector<int> inliersIDs;
int matches;
float variance;
std::vector<int> matchesIDs;
std::vector<int> projectedIDs; // "From" IDs
std::vector<int> inliersPerCam;
std::vector<int> matchesPerCam;
int inliers; /**< Number of visual inliers. */
float inliersRatio; /**< Ratio of inliers to matches. */
float inliersMeanDistance; /**< Mean reprojection or descriptor distance of inliers. */
float inliersDistribution; /**< Spatial spread of inliers in the image. */
std::vector<int> inliersIDs; /**< Indices of inlier keypoints. */
int matches; /**< Total visual matches before outlier rejection. */
float variance; /**< Estimated variance of the visual constraint. */
std::vector<int> matchesIDs; /**< Indices of all matches. */
std::vector<int> projectedIDs; /**< Source ("from") feature IDs used in projection. */
std::vector<int> inliersPerCam; /**< Inlier count per camera (multi-camera). */
std::vector<int> matchesPerCam; /**< Match count per camera (multi-camera). */
// RegistrationIcp
float icpInliersRatio;
float icpTranslation;
float icpRotation;
float icpStructuralComplexity;
float icpStructuralDistribution;
int icpCorrespondences;
float icpRMS;
float icpInliersRatio; /**< Ratio of ICP inlier correspondences. */
float icpTranslation; /**< Translation component of the ICP correction (m). */
float icpRotation; /**< Rotation component of the ICP correction (rad). */
float icpStructuralComplexity; /**< Structural complexity of the scan overlap. */
float icpStructuralDistribution; /**< Distribution of structural features in the overlap. */
int icpCorrespondences; /**< Number of ICP point correspondences. */
float icpRMS; /**< Root-mean-square error of ICP correspondences (m). */
};
}
+25 -2
View File
@@ -41,23 +41,46 @@ class Feature2D;
class PyMatcher;
#endif
// Visual registration
/**
* @class RegistrationVis
* @brief Visual registration between two signatures using features and geometry.
*
* Extracts and matches features (@ref Feature2D), then estimates motion with
* **Vis/EstimationType** (3D→3D, 3D→2D PnP, or 2D→2D epipolar). Supports RGB-D
* (@ref CameraModel + depth), stereo (@ref StereoCameraModel), optical flow, GMS,
* and optional Python matchers when built with Python support.
*
* Can chain a @ref child_ registration (e.g. @ref RegistrationIcp in
* @ref Registration::kTypeVisIcp). Feature-related Vis/ parameters are mapped
* to Kp/ for @ref Feature2D::create().
*
* @see Registration
* @see RegistrationInfo
*/
class RTABMAP_CORE_EXPORT RegistrationVis : public Registration
{
public:
// take ownership of child
/** @brief @p child is owned and deleted in the destructor. */
RegistrationVis(const ParametersMap & parameters = ParametersMap(), Registration * child = 0);
virtual ~RegistrationVis();
/** @brief Parses Vis/ and feature parameters; recreates feature detectors. */
virtual void parseParameters(const ParametersMap & parameters);
/** @return **Vis/InlierDistance** (m). */
float getInlierDistance() const {return _inlierDistance;}
/** @return **Vis/Iterations** (RANSAC iterations). */
int getIterations() const {return _iterations;}
/** @return **Vis/MinInliers**. */
int getMinInliers() const {return _minInliers;}
/** @return **Vis/CorNNType** nearest-neighbor strategy. */
int getNNType() const {return _nnType;}
/** @return **Vis/CorNNDR** ratio test threshold. */
float getNNDR() const {return _nndr;}
/** @return **Vis/EstimationType** (0: 3D→3D, 1: PnP, 2: epipolar). */
int getEstimationType() const {return _estimationType;}
/** @return Feature detector used for the “from” signature. */
const Feature2D * getDetector() const {return _detectorFrom;}
protected: