8000 Consistent interface/tests for rigid3d/sim3d/affine2d, pycolmap bindings for rigid3d by ahojnnes · Pull Request #3051 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 8 commits into from
Dec 17, 2024

Conversation

ahojnnes
Copy link
Contributor
  • 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,
Copy link
Contributor Author

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.

@B1ueber2y
Copy link
Contributor

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.

@ahojnnes
Copy link
Contributor Author

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.

@B1ueber2y
Copy link
Contributor
B1ueber2y commented Dec 17, 2024

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).

@ahojnnes
Copy link
Contributor Author
ahojnnes commented Dec 17, 2024

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.

@ahojnnes
Copy link
Contributor Author
ahojnnes commented Dec 17, 2024

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.

@B1ueber2y
Copy link
Contributor
B1ueber2y commented Dec 17, 2024

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 minimal, the residuals would by definition always be perfectly zero. Hence, it is an over constrained problem.

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.

@B1ueber2y
Copy link
Contributor

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 : )

@ahojnnes ahojnnes merged commit b7fc9ff into main Dec 17, 2024
16 checks passed
@ahojnnes ahojnnes deleted the user/jsch/rigid-sim-affine branch December 17, 2024 21:33
HernandoR pushed a commit to HernandoR/colmap that referenced this pull request Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0