-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Consistent interface/tests for rigid3d/sim3d/affine2d, pycolmap bindings for rigid3d #3051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add new functions EstimateRigid3d, EstimateRigid3dRobust, EstimateAffine2d, Estimate2dRobust (consistent with existing EstimateSim3d and Sim3dRobust).
- Improved tests for all of the transformations.
- Expose estimate_rigid3d and estimate_rigid3d_robust in pycolmap bindings.
- Add Rigid3d::FromMatrix (consistent with Sim3d::FromMatrix).
|
||
residuals->resize(points1.size()); | ||
|
||
// Note that this code might not be as nice as Eigen expressions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true anymore in recent profiling.
Non-relevant to the update in this PR but relevant to the topic (spotted while reviewing): here the comment is wrong (actually from the initial commit of COLMAP in 2016 xD)? https://github.com/colmap/colmap/blob/main/src/colmap/estimators/similarity_transform.h#L64-L67 For both rigid and similarity transformation k is always minimal for k dimension and it is not overconstrained due to dependent constraints. |
I believe the comment is correct in that a 3D similarity transformation only has 7 degrees of freedom. While you need 3 points, you can drop 2 coordinates of the third point to obtain the true minimal system of equations. |
But if one assumes this is a similarity transformation there are 2 dependent constraints. Its similar to the classic confusion: 3 points are actually minimal for Rigid3d although a Rigid3d object only has 6 DoFs (because if it is rigid there will always be 3 dependent constraints from 3 points). |
I don't think this is correct for 3D similarity transformation but I am also on my phone now... take it with a grain of salt. |
Maybe to proof my point: I can easily find you two sets of three 3D points and you will not be able to fit a rigid3 or sim3 that always perfectly fits these points, ie the residuals of the transformed points will not all be perfectly zero. If it was indeed well determined, the residuals would by definition always be perfectly zero. Hence, it is an over constrained problem. EDIT: Thinking a little more, I believe we are talking about different things and we may be both right. The system is minimal in the sense that you cannot estimate the transformation in the general configuration with less than 3 points and 9 coordinates. However, the system is still over constrained in the sense that the transformation cannot perfectly fit the points. |
With Rigid3d a solver will get perfect zero with two points, but it is always degenerate because the two point samples are not independent due to the distance preserving property. With three points satisfying the distance-preserving property there are always only 6 independent constraints so only finite solution. I think one could not say that 2-point solver for Rigid3d is minimal and 3-point is not, but this can be inferred from your reasoning about residuals being perfect zero. So I am not very convinced. Sim3d is similar to Rigid3d with one additional degree of freedom but also one less dependent constraints. I agree that two points plus one dimension of the third point is minimal here, but this is because that all the 6 DoFs from the first two points can be used here with one of them for the scale. I believe the fact that three perfect point correspondences gives minimal number of independent constraints is the rationale for its minimality, but in the end it comes to how the term "minimal solver" is defined. |
I think the confusion mostly comes from the fact that 2-point Rigid3d solver is minimal but always degenerate. I am happy to move on to leave the comments as it is. Thanks : ) |