Implement a function to estimate a similarity transformation from 2D image observations and corresponding 3D points. The function should adhere to the following specifications:
Function Signature:
Define a function named EstimateSimilarityTransformation2D3D that takes the following parameters:
const RansacParameters& params: Parameters for the RANSAC algorithm controlling its behavior.
RansacType ransac_type: Type of RANSAC to use (could be standard RANSAC or others).
const std::vector<CameraAndFeatureCorrespondence2D3D>& correspondences: A vector containing pairs of 2D observations and their corresponding 3D points.
SimilarityTransformation* estimated_transformation: Pointer to store the estimated similarity transformation (output).
RansacSummary* ransac_summary: Pointer to a structure that will store RANSAC results.
Functionality Requirements:
The function should implement the RANSAC algorithm appropriately:
Randomly select subsets of point correspondences to estimate transformation parameters.
Compute model consensus, identifying inliers based on the reprojection error defined by params.error_thresh.
Repeat the process for a number of iterations determined by params.max_iterations.
Collect the best transformation model that maximizes the number of inliers.
Utilization of Eigen Libraries:
Use Eigen library data structures for matrix and vector operations.
Compute the similarity transformation parameters (rotation, translation, scale) using Eigen's capabilities.
Error Handling:
Ensure that the function gracefully handles cases with insufficient inliers and updates the ransac_summary accordingly.
Unit Tests:
Ensure that the implementation is compatible with the provided test cases in the code. Specifically, it should handle cases with different levels of noise and the presence of outliers as outlined in the unit tests.
Location:
Place the implementation in the /app/ directory, in a source file named estimate_similarity_transformation.cpp.
Upon completion, the function should successfully pass the existing test cases without modification, confirming its accuracy and effectiveness.