-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Feat #25150: Pose Graph MST initialization #27423
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
Feat #25150: Pose Graph MST initialization #27423
Conversation
Hi @asmorkalov, We noticed that no reviewers have been assigned to this PR yet. Is there a specific reason for this? Let us know if there's anything we can do to move this PR forward. Thanks! |
Hi @asmorkalov, thanks for the feedback! Please let us know if everything looks good now or if there’s anything else you'd like us to adjust! |
Hi @asmorkalov, could you trigger CI again? It seems to have failed to clone opencv_extra? |
@asmorkalov Friendly reminder |
Implements a MST-based initialization for pose graphs, as proposed in issue opencv#25150. Both Prim’s and Kruskal’s algorithms were added to the 3D module, receiving a vector of node IDs and a vector of edges (each with source/target IDs and a weight) and returning a vector with the resulting edges. These MST implementations treat edges as undirected internally, meaning users only need to provide one direction (A→B or B→A), and duplicates are handled automatically. Additionally, a new pose graph initialization method using MST was implemented. It constructs the MST over the pose graph, then traverses it to reconstruct node poses. A set of test cases validating the implementation was also included. Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
915069a
to
7a52f3c
Compare
Hi @asmorkalov, @opencv-alalek, we've just pushed a new version addressing your reviews. Please let me know if everything looks good or if there's anything you'd like us to adjust. |
Hi @asmorkalov, could you please re-trigger the CI? The Docker pull failed. Thanks! |
- Replaces invalid algorithm handling with CV_Error (review comment) - Adds check for disconnected graphs (review comment) - Skips self-loop edges (where source == target) - Adds root < 0 validation - Improves MST Doxygen documentation Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
Hi @asmorkalov, just pushed a new version addressing your comments! Let me know if this looks good to you. |
Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
Hi @asmorkalov, you're right that part of the code is not needed anymore, and I just left it there for comparison (I will comment out the old code). Also, please take a look at what I said in my last commit, which you may have missed, and it explains the whole situation better:
So I’d like to ask for your opinion on the best approach here:
Let me know what you think! Note: We are using this 3d viewer to open the .obj files and see the pose graph(s). |
Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
Let's presume the original "hand made" version, but please add a comment why it differs from saveMesh. It's not obvious without detailed code analysis. |
Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
Co-authored-by: Miguel Agra <miguel.agra@tecnico.ulisboa.pt>
Hi @asmorkalov, Thank you for approving our PR. Could you please merge it when you have a moment? Let us know if there's anything else you need from us. |
Implements an MST-based initialisation for pose graphs, as proposed in issue #25150. Both Prim’s and Kruskal’s algorithms were added to the 3D module. These receive a vector of node IDs and a vector of edges (each with source and target IDs and a weight), and return a vector with the resulting edges. These MST implementations treat edges as undirected internally, meaning users only need to provide one direction (A→B or B→A), and duplicates are handled automatically.
Additionally, a new pose graph initialisation method using MST (Prim) was implemented. It constructs the MST over the pose graph, then traverses it to reconstruct node poses. With this, users can call
poseGraph->initializePosesWithMST()
to create an initial solution for the pose graph problem.A set of test cases validating the implementation was also included.
Notes
weight = || translation || + λ * rotation_angle
,where λ = 0.485 was determined empirically based on optimiser performance;
Future Work
Co-authored-by: @miguel1099
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.