8000 Add frame impl for future rig support by B1ueber2y · Pull Request #2698 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

Add frame impl for future rig support #2698

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 46 commits into from
Feb 5, 2025
Merged

Conversation

B1ueber2y
Copy link
Contributor
@B1ueber2y B1ueber2y commented Aug 10, 2024

A draft implementation of the frame class for the rig support, with backward compatibility. However, with the new design CamFromWorld() wont make sense as a reference anymore when the frame is nontrivial, where we need to composite cam_from_world from the rigs rather than directly using the member variable. I currently throw error on this, which will potentially break a lot of implementations with CamFromWorld() when we really use the rig as input (which should break since they dont currently support rigs).

Feedbacks on this will be helpful. Marked as draft for now. @ahojnnes @sarlinpe

@B1ueber2y B1ueber2y marked this pull request as draft August 10, 2024 04:18
Copy link
Contributor
@ahojnnes ahojnnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. This seems to match what we discussed some months ago, but I also don't have everything still in memory :-) I left a few comments and suggestions.

@B1ueber2y
Copy link
Contributor Author
B1ueber2y commented Aug 26, 2024

Once we are happy with the class design, I could try to start removing the use of colmap::CameraRig and adapt visual-only RigBundleAdjuster with the new Frame class when I find time, as a better starting point for multi-sensor rig development.

@ahojnnes
Copy link
Contributor

Thanks @B1ueber2y. On the high-level, this looks good to me. I suggest to also gain @sarlinpe's feedback 8000 before we move ahead. Cheers.

@B1ueber2y
Copy link
Contributor Author

Thanks @B1ueber2y. On the high-level, this looks good to me. I suggest to also gain @sarlinpe's feedback before we move ahead. Cheers.

Thanks. @sarlinpe PTAL when time permits : )

Copy link
Contributor
@ahojnnes ahojnnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, some final comments from my side.

In terms of next steps, I was hoping that, in addition to the IMU/frame BA, we can also adjust database and reconstruction I/O and then also incremental mapper to support rigs. This will be a longer term project. It may make sense to catch up in person before embarking on this journey. :-)

@B1ueber2y
Copy link
Contributor Author
B1ueber2y commented Feb 4, 2025

Looks great to me, some final comments from my side.

In terms of next steps, I was hoping that, in addition to the IMU/frame BA, we can also adjust database and reconstruction I/O and then also incremental mapper to support rigs. This will be a longer term project. It may make sense to catch up in person before embarking on this journey. :-)

Thanks for all the comments. I have just addressed them all and added some tests.

Actually after thinking about it more, the next step would actually already be to adjust database and reconstruction I/O rather than to support the BA. We would love to store the rig calibration (std::map<rig_t, std::shared_ptr<RigCalibration>>) and all the frames (std::map<frame_t, std::shared_ptr<Frame>>) in the reconstruction. This will also result in full unification of rig and normal setup on the data structure level. However, this I/O will be made easier when the proto is available. What s your take on this?

On the other hand, do you think we should first merge this PR as a quote and then develop the I/O and BA, and do it in separate PRs one after another?

Yes. Supporting incremental mapper and global mapper on top of rigs will be very exciting but effort demanding. Lets find some time to catch up in person and discuss in more details : )

@B1ueber2y B1ueber2y marked this pull request as ready for review February 5, 2025 12:42
@ahojnnes
Copy link
Contributor
ahojnnes commented Feb 5, 2025

As for next steps, I suggest decoupling changes to I/O format from rig support, unless we think that it's fundamentally not possible to do this with the existing custom format. I am all in for protobuf serialization but want to be very careful here in the sense that I don't want to break existing users. Ideally, we can be fully backwards compatible to existing models. I guess we could create a new frames.bin file and a new rigs.bin file. The existing cameras/images/points3D could stay identical?

Copy link
Contributor
@ahojnnes ahojnnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to go ahead and directly merge. Thanks!

@B1ueber2y
Copy link
Contributor Author
B1ueber2y commented Feb 5, 2025

As for next steps, I suggest decoupling changes to I/O format from rig support, unless we think that it's fundamentally not possible to do this with the existing custom format. I am all in for protobuf serialization but want to be very careful here in the sense that I don't want to break existing users. Ideally, we can be fully backwards compatible to existing models. I guess we could create a new frames.bin file and a new rigs.bin file. The existing cameras/images/points3D could stay identical?

Sounds good. We can do either of the following two regarding the frame association in the I/O:

  1. keep the cameras/images/points3D fully identical as before, and write into frames.bin and rigs.bin only when there are non-trivial frame available. At reading, we check if there are frames.bin and rigs.bin available in the same directory. If so we read in the frames/rigs and update the corresponding images. The benefit for this is that it will be fully backwards compatible, but the drawback is that from images.bin itself we will have no idea about the rig/frame information.

  2. store an additional frame id field in the image. At reading, when the frame id is valid we look for frames.bin and rigs.bin. Contrary to 1), the benefit is that from images.bin we already have the frame correspondence, while the drawback is slightly different file format from before and broken reading when users use the previous version of COLMAP to read into the new format.

@B1ueber2y B1ueber2y enabled auto-merge (squash) February 5, 2025 22:39
@B1ueber2y B1ueber2y merged commit d088fcb into colmap:main Feb 5, 2025
16 checks passed
@B1ueber2y B1ueber2y deleted the features/frame branch February 5, 2025 23:54
@ahojnnes
Copy link
Contributor
ahojnnes commented Feb 6, 2025

I think it is fine to let images have no idea about their association to rigs/frames. Frames are the concept that ties together sensor measurements (ie images) and rig calibrations. Do you see a problem with that other than having to read frame and rig files first, so we can correctly populate the data structures?

@B1ueber2y
Copy link
Contributor Author
B1ueber2y commented Feb 6, 2025

I think it is fine to let images have no idea about their association to rigs/frames. Frames are the concept that ties together sensor measurements (ie images) and rig calibrations. Do you see a problem with that other than having to read frame and rig files first, so we can correctly populate the data structures?

Sounds good. This will the next step, and should not be that difficult. I will find time for this but probably only next week.

The short-term roadmap for this will be:

  • add frame and rig calib to Reconstruction class and support I/O with custom format
  • support rig bundle adjuster with the new Reconstruction class and deprecate RigBundleAdjuster
  • integrate the other PR on IMU sensor and preintegration factors, support I/O on imu measurements

We could discuss about long-term rig sfm offline : )

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
0