Skip to content

Introduce Cropping to OpenCV Stitching Tool#21420

Merged
alalek merged 6 commits intoopencv:4.xfrom
lukasalexanderweber:4.x
Feb 1, 2022
Merged

Introduce Cropping to OpenCV Stitching Tool#21420
alalek merged 6 commits intoopencv:4.xfrom
lukasalexanderweber:4.x

Conversation

@lukasalexanderweber
Copy link
Copy Markdown
Contributor

@lukasalexanderweber lukasalexanderweber commented Jan 10, 2022

The Stitching Pipeline can be extended by estimate cropping ROIs in low resolution:

StitchingPipeline

Therefore, the warped low resolution images can be blended together to create a blend mask on which the largest interior rectangle (lir) can be found. At the moment the outline approach of the lir repository is used, which can detect the lir in 0.1s in a 1 MP image. The Algorithm used is Marzeh, Tahmasbi and Mireh (2019): Algorithm for finding the largest inscribed rectangle in polygon, optimized on the outline of a binary raster. On the long run, it might be worth to integrate the functionality natively in opencv. Using the lir (red), the cropping roi (blue) of a single image (green) can be determined and used for cropping both the small and the full resolution images.

intro3

Cropping the images on low resolution and before estimating the seam masks has mayor benefits:

  1. The Estimation is faster
  2. Without cropping the seams need to go from image corner to image corner:

sample0

With cropping the seam carving is much more natural:

sample1

I already updated the opencv_stitching_tutorial with a more detailed explaination of the cropping procedure.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=linux,docs

@lukasalexanderweber
Copy link
Copy Markdown
Contributor Author

@alalek I don't exactly know where the whitespace error is

@lukasalexanderweber
Copy link
Copy Markdown
Contributor Author

lukasalexanderweber commented Feb 1, 2022

@alalek fixed it

Copy link
Copy Markdown
Member

@alalek alalek 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 for contribution 👍

@alalek alalek merged commit d37bcbd into opencv:4.x Feb 1, 2022
@alalek alalek mentioned this pull request Feb 22, 2022
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
Introduce Cropping to OpenCV Stitching Tool

* Introduced Cropping

* integrate opencv#21413

* fixed failing subsetter tests

* updated stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants