-
Notifications
You must be signed in to change notification settings - Fork 5.9k
structured_light: GreyCodePattern 16-bit support and performance improvements #3992
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
base: 4.x
Are you sure you want to change the base?
Conversation
b2c445a to
bff58b8
Compare
…ovements - Vastly improve performance of the GreyCodePattern structured light algorithm by leveraging built-in OpenCV functions and parallel code instead of raw loops, at the cost of a bit more memory (decoding a set of 96 5320x4600 images acquired using stereo cameras goes from taking ~100 seconds to taking ~2.5 seconds, in release mode) - Automatically gain the ability to decode 16-bit images (switching from raw loops and uchar-indexing to OpenCV functions gives this for free) Manual testing was done to ensure that the calculated results are correct, both for generation of the patterns and for decoding, in both Debug and Release mode, using real world data.
bff58b8 to
441c955
Compare
|
@asmorkalov sorry to ping but I wanted to know if there was any chance for this PR to get looked at or not. I would be very interested in this code ending up in the official release of opencv_contrib |
|
@Atari2 Could you also add some test(s) for the new feature? |
…vements regression checks Created shared plane test logic into test_plane_common.hpp and updated test_plane.cpp and test_plane_16bit.cpp to use the new common template. Created some tests for 16u support and graycode pattern verification in test_graycodepattern_fast.cpp
|
Thank you for the review @asmorkalov, sorry again to disturb 😅 I also added a few tests to verify that the 16-bit images and data are correctly handled. Tell me if you need anything different and if what I added is OK. I see in the github CI that there is 1 run failing but I don't think that it is related to anything that I changed, because I only touched the structured_light submodule. |
This PR aims to greatly improve performance of the GreyCodePattern algorithm in the StructuredLight module. It does so by caching and pre-calculating a bunch of stuff needed for the computation and instead of doing manual looping and indexing over the matrices it leverages built-in opencv functions to automatically parallelize work (as well as doing some manual parallelization). Additionally, thanks to the fact that it is using opencv functions, it gains the ability to correctly process 16-bit images, which is a plus.
Work done in more detail:
Manual testing was done to ensure that the calculated results are correct, both for generation of the patterns and for decoding, in both Debug and Release mode, using real world data.
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.