Skip to content
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

Added a check if the image_id is part of the correspondence graph. #1541

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

humenbergerm
Copy link

If it is not, and the image_registrator tries to set an observation from that image to triangulated, it will crash with an error in CorrespondenceGraph::FindCorrespondences because it tries to access an image in the graph that does not exist.

"terminating with uncaught exception of type std::out_of_range: unordered_map::at: key not found"
This can happen if you use, for example, a reconstruction that was created by only using the point_triangulator and not the entire SFM pipeline.

mhumenbe and others added 2 commits June 13, 2022 14:19
… it is not, and the image_registrator tries to set an observation from that image to triangulated, it will crash with an error in CorrespondenceGraph::FindCorrespondences because it tries to access an image in the graph that does not exist.

"terminating with uncaught exception of type std::out_of_range: unordered_map::at: key not found"
This can happen if you use, for example, a reconstruction that was created by only using the point_triangulator and not the entire SFM pipeline.
@ahojnnes
Copy link
Contributor

Hi, thanks for the fix! Could you explain the scenario under which this would happen? It seems like this can only happen when the correspondence graph is inconsistent with the reconstruction. The code was written with the intent that the correspondence graph always contains a superset of the reconstruction (admittedly, that not being documented in any way).

@humenbergerm
Copy link
Author

humenbergerm commented Jun 14, 2022

Hi! I think this is a special case that occurs for us when we want to register new images in an existing reconstruction that was created outside of COLMAP and when the corresponding db does not contain two-view geometries for the images involved (reference images). That is the case, e.g., if we use RGBD images (incl. 6DOF poses) to create the 3D points instead of triangulating keypoint matches (example script). In order to register new images in this reconstruction using the image_registrator (we use this script), we need to create feature matches between the reference images and the new images (and import them into the db in order to create the two-view geometries). Since the two-view geometries between the reference images are missing, the image_registrator will create the correspondence graph only with the ones between the reference images and the new images. It can then happen that some reference images are not connected and those ones will be ignored by my fix. At least that is how I understand it.
An alternative solution would be to create the missing reference two-view geometries and to import them as well. This would probably be a bit of an overkill since those two-view geometries would not be used for anything else.
What do you think?

@ahojnnes
Copy link
Contributor

Sorry for the slow response and thanks for the context. I need to read this code carefully again, as I wrote this many years ago. Let me try to find some time to understand but, given that you log out a clearly visible warning, I don't see a big concern with this change. Anyway, let me try to find some time and understand again :-)

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.

3 participants