-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Camera spatial velocity computation through interaction matrix #3641
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my mind:
- This should go into the
tracking
module - We should use sparse set of point correspondences, not dense and definitely not based on a specific optical flow algorithm.
- The problem as it is formulated now can be solved by a combination of
findEssentialMat
+decomposeEssentialMat
orrecoverPose
and Rt-to-twist decomposition available inDualQuat
class from 5.x, even without using additional Z coordinates. And it's more preferable since the existing functions are quite robust and fast, thanks to RANSAC. - This function would make more sense as a solution to a different problem if it is changed to take pixel velocities as input instead of images or points.
- The function should be documented
- The function should be covered by at least one test. You can transform your sample code to a test.
moved
removed the the flow calculation from withing the class
I suppose this doesn't provide information about the scale of the scene? Having the depth input here, the velocity information is in absolute units right away.
I've refactored the code to explicitly take in the pixel velocities.
Done
Done Also made the interaction matrix computation as public method. Thus one could use that for visual servoing applications, like driving a camera with specific pixel velocities, or up to a pixel location. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, we need Z values to get an absolute scene scale. This means that we do need that functionality.
However, there are things to fix before it's merged:
Addressed all of the comments |
@savuor Could you rerun the CI, I've removed some dead comments in tests and fixed miss-matched docs parameter. Should pass all the checks now : ) |
LGTM |
Feature
The code computed camera spatial velocity given two images, pixels depth, camera matrix and the timestamp between the images. This is enabled by, so called, interaction matrix (usually utilized in visual servoing applications) relating pixel plane velocities to the camera spatial velocity in 3D i.e., twist - velocity and angular rate of the camera. The inverse problem can be solved by sampling pixel & their velocities to solve least-squares for twist. The relationship can be seen below in the picture.
The code does not include a proper example and is not tested but if there is interest I could contribute more appealing example and use case for camera velocity computation. However, I attach below a dummy example with random data simply to make sure that it's running as is. I have used this before in aiding UAV localization and thought someone else might benefit from it being integrated into
opencv
.References
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.