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

Fix distransform to work with large images #22798

Merged
merged 4 commits into from Jun 19, 2023

Conversation

lamm45
Copy link
Contributor

@lamm45 lamm45 commented Nov 12, 2022

This attempts to fix the following bug which was caused by storing squares of large integers into 32-bit floating point variables:
#22732

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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the 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

@asmorkalov asmorkalov requested review from opencv-alalek and removed request for alalek May 16, 2023 11:49
@asmorkalov
Copy link
Contributor

@opencv-alalek Could you take a look on the PR?

@opencv-alalek opencv-alalek removed their assignment May 26, 2023
@opencv-alalek opencv-alalek removed their request for review May 26, 2023 05:33
@asmorkalov asmorkalov modified the milestones: 3.4.20, 4.9.0 May 26, 2023
@asmorkalov asmorkalov requested a review from vpisarev May 29, 2023 09:23
@asmorkalov
Copy link
Contributor

@vpisarev Friendly reminder on tests.

* converted square to 'almost' square
* added another case when there is just one zero pixel in a huge square, so that the distance map is non-trivial.
@vpisarev
Copy link
Contributor

@asmorkalov, the patch is ready for integration; I've added non-trivial test case and fixed warnings

@asmorkalov asmorkalov merged commit ddcbd2c into opencv:3.4 Jun 19, 2023
16 checks passed
@asmorkalov asmorkalov modified the milestones: 4.9.0, 4.8.0 Jun 19, 2023
@asmorkalov asmorkalov mentioned this pull request Jun 19, 2023
@asmorkalov asmorkalov mentioned this pull request Jul 27, 2023
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
Fix distransform to work with large images opencv#22798

This attempts to fix the following bug which was caused by storing squares of large integers into 32-bit floating point variables:
opencv#22732


### Pull Request Readiness Checklist

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

distanceTransform() give wrong results for large images
5 participants