Refactor stitching detailed python#20723
Closed
lukasalexanderweber wants to merge 71 commits intoopencv:masterfrom
lukasalexanderweber:refactor_stitching_detailed_python
Closed
Refactor stitching detailed python#20723lukasalexanderweber wants to merge 71 commits intoopencv:masterfrom lukasalexanderweber:refactor_stitching_detailed_python
lukasalexanderweber wants to merge 71 commits intoopencv:masterfrom
lukasalexanderweber:refactor_stitching_detailed_python
Conversation
added 30 commits
July 29, 2021 10:19
…s to move warped_image_scale declaration in composition part
…thods for FeatureMatcher
added 23 commits
August 16, 2021 08:26
…excluded subsetter functionality
Contributor
Author
|
If accepted, we can squash the commits when merging the pull request! |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The advanced stitching example stitching_detailed.py is a big script with awesome functionality. It is, however, very long and a bit unstructured to grasp what's going on. It's by far the most complex script in the python samples folder:
There is, however, a very clear pipeline description:
I changed the stitching_detailed.py so that it only contains the argument parser. At the end, the functionality of the stitcher class is called. The stitcher class follows precisely the stitching pipeline of the image. Unlike in the original program, the intermediate results can be obtained and analysed easily.
I didn't changed much of the functionality, the most work was done in structuring the functionality. I added the possibility to specify the number of features (default 500) in the Feature Detection step, since 500 features are not enough for my REALY big plans (see this issue/question).
Additionally, I added functionality to subset the matches and cameras, which was not done in the original file. If there are noise images at the beginning, this leads to significant artefacts:
python stitching_detailed.py s1.jpg s2.jpg boat5.jpg boat2.jpg boat3.jpg boat4.jpg boat1.jpg boat6.jpg --compose_megapix 3 --output boat_default_with_noise_original.jpg --save_graph boat_default_with_noise_original.txtWith the proposed changes, this is not an issue anymore. The performance speed is the same as before the restructuring, the RAM needed reduced for the boat example from 130MB to 95MB. See test_performance.py. The tests can be found here. With a view to the tutorial, I tested different settings for the boat example as well as the affine example of the budapest map within test_stitcher.py
Background: I need to stitch >10000 plans of waterway-infrastructure buildings. During digitalization, the scanner was too small for the whole plan. There are overlaps that allow the use of the stitching algorithm and I'm thankful that OpenCV contains the stitcher module. For documentation purposes for my work I wanted to structure the code and now hope to discuss if the changes might could merged into the opencv master branch.
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.