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

Feature/rolling shutter smart factors #827

Merged
merged 53 commits into from
Aug 28, 2021

Conversation

lucacarlone
Copy link
Contributor

@lucacarlone lucacarlone commented Jul 21, 2021

  • added jacobians for interpolate (@shteren1)
  • added projection factor for rolling shutter camera (@shteren1)
  • added tests for projection factor
  • added Smart projection factor with rolling shutter
  • added tests for Smart projection factor with rolling shutter

@lucacarlone lucacarlone added the wip This is still a work in progress label Jul 21, 2021
@lucacarlone
Copy link
Contributor Author

@shteren1 : I added the tests and applied minor changes to your implementation (which already looked great and worked out of the box!). The ProjectionFactor part is pretty much ready. Now I will move to developing the smart factor version. Let me know if you have comments.

gtsam/base/Lie.h Outdated Show resolved Hide resolved
@shteren1
Copy link

shteren1 commented Jul 21, 2021

Thanks Luca! I know the factor works, I've used it extensively to create stunning vision only rolling shutter SLAM's with loop closures and all.

It did compile on the original version I developed it on - 4.0.3 stable, not sure why it failed to compile on the PR, thanks for taking care of it.

@dellaert @lucacarlone I also have a version of this factor that accepts body-to-sensor pose3 matrix and optimizes it, incase of a multi camera setup with unknown calibration between cameras. I thought it was very nitche'y so I didn't add it, but if you see value it in I can add it also.

@lucacarlone
Copy link
Contributor Author

Thanks Luca! I know the factor works, I've used it extensively to create stunning vision only rolling shutter SLAM's with loop closures and all.

It did compile on the original version I developed it on - 4.0.3 stable, not sure why it failed to compile on the PR, thanks for taking care of it.

@dellaert @lucacarlone I also have a version of this factor that accepts body-to-sensor pose3 matrix and optimizes it, incase of a multi camera setup with unknown calibration between cameras. I thought it was very nitche'y so I didn't add it, but if you see value it in I can add it also.

cool! out of curiosity: what tool did you use to calibrate the row readout time? also: did you still use a RANSAC-like preprocessing to filter out outliers before the optimization?

I will leave it to @dellaert to decide if the other body-to-sensor factor is of interest. I'll be happy to help with the tests if needed.

@shteren1
Copy link

shteren1 commented Jul 21, 2021

I work with a specific camera for which I know all the intrinsic parameters and read times so I didn't require any calibration for that.

As far as the SLAM goes, I used a simple essential matrix estimation between consecutive frames to initialize the SLAM, the essential matrix part used the RANSAC + essential matrix calculation from opencv. I know its possible to build a similar optimizer with gtsam but opencv's one has a complete simple usage solution that works fast. I also used SIFT extraction and matching from opencv to build the SLAM graph.

@lucacarlone
Copy link
Contributor Author

I work with a specific camera for which I know all the intrinsic parameters and read times so I didn't require any calibration for that.

As far as the SLAM goes, I used a simple essential matrix estimation between consecutive frames to initialize the SLAM, the essential matrix part used the RANSAC + essential matrix calculation from opencv. I know its possible to build a similar optimizer with gtsam but opencv's one has a complete simple usage solution that works fast. I also used SIFT extraction and matching from opencv to build the SLAM graph.

great - thanks for sharing!

@shteren1
Copy link

@lucacarlone it looks good I went over the code, very impressive work with the jacobians there. looking forward to using it once its merged.

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

Very cool. Would like to take another look so marking Request Changes, but I think it's close.

gtsam/base/Lie.h Outdated Show resolved Hide resolved
gtsam/base/Lie.h Outdated Show resolved Hide resolved
gtsam/base/Lie.h Outdated Show resolved Hide resolved
gtsam/geometry/CameraSet.h Outdated Show resolved Hide resolved
gtsam/geometry/CameraSet.h Outdated Show resolved Hide resolved
gtsam_unstable/slam/ProjectionFactorRollingShutter.h Outdated Show resolved Hide resolved
gtsam_unstable/slam/ProjectionFactorRollingShutter.h Outdated Show resolved Hide resolved
gtsam_unstable/slam/ProjectionFactorRollingShutter.h Outdated Show resolved Hide resolved
@lucacarlone
Copy link
Contributor Author

@dellaert @shteren1 : thanks for the comments. I'll implement them in the next few days and ping you when ready.

@shteren1
Copy link

@dellaert regarding alpha greater than 1, it is required for the edge case of the last pose in the graph.
since you don't have the next pose to interpolate with, you must do a small extrapolation using the previous pose.
I tried using a generic projection factor just for the last pose in the graph and It's position got slightly distorted. I think using a small extrapolation is a better solution.

@lucacarlone
Copy link
Contributor Author

@dellaert regarding alpha greater than 1, it is required for the edge case of the last pose in the graph.
since you don't have the next pose to interpolate with, you must do a small extrapolation using the previous pose.
I tried using a generic projection factor just for the last pose in the graph and It's position got slightly distorted. I think using a small extrapolation is a better solution.

I agree with @shteren1 that having the option to extrapolate would be useful. I plan to use this in Kimera, and if we can extrapolate the integration in our code will be straightforward.

@dellaert
Copy link
Member

Yeah, no worries: just document: "typically \in [0,1] but can also be used to extrapolate before pose A or after pose B." ?

@lucacarlone lucacarlone mentioned this pull request Aug 28, 2021
Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

I fixed the template issue and formatted new files with clang-format, Google style. Will merge after CI is complete.

@dellaert
Copy link
Member

@shteren1 could you add unit tests for Lie::interpolate though? It's a fairly complex Jacobian calculation which was added but has no direct unit test. See #864

@lucacarlone
Copy link
Contributor Author

I fixed the template issue and formatted new files with clang-format, Google style. Will merge after CI is complete.

great - thanks!

@lucacarlone
Copy link
Contributor Author

@shteren1 could you add unit tests for Lie::interpolate though? It's a fairly complex Jacobian calculation which was added but has no direct unit test. See #864

I think I added unit tests for that in testPose3. should I move to testLie?

@dellaert
Copy link
Member

PS @lucacarlone @shteren1 part of the issue was some arguments were not const&, just const. Somehow that prevented template instantiation. But changing to const& also helps with performance, as only a pointer is passed.

@lucacarlone
Copy link
Contributor Author

PS @lucacarlone @shteren1 part of the issue was some arguments were not const&, just const. Somehow that prevented template instantiation. But changing to const& also helps with performance, as only a pointer is passed.

thanks for figuring that out! (btw: I also figured out the clang formatting issue - thanks for mentioning the style was off)

@dellaert dellaert merged commit d7f048b into develop Aug 28, 2021
@dellaert
Copy link
Member

Ok, @lucacarlone . Merged, so you can now merge develop into your other PR branches. Hopefully not too many conflicts due to formatting.

@dellaert dellaert deleted the feature/rollingShutterSmartFactors branch August 28, 2021 22:43
@lucacarlone
Copy link
Contributor Author

the merge was not too bad so far - thanks @dellaert !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New proposed feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants