Skip to content

Fix imgwarp at borders when transparent.#23922

Merged
asmorkalov merged 3 commits intoopencv:4.xfrom
vrabaud:imgwarp
Jul 12, 2023
Merged

Fix imgwarp at borders when transparent.#23922
asmorkalov merged 3 commits intoopencv:4.xfrom
vrabaud:imgwarp

Conversation

@vrabaud
Copy link
Copy Markdown
Contributor

@vrabaud vrabaud commented Jul 4, 2023

I believe this is a proper fix to #23562

The PR #23754 overwrites data while that should not be the case with transparent data. The original test is failing because points at the border do not get computed because they do not have 4 neighbors to be computed. Still ,we can approximate their computation with whatever neighbors that are available.

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

@vrabaud vrabaud requested a review from dkurt July 4, 2023 14:19
@dkurt dkurt self-assigned this Jul 4, 2023
@dkurt
Copy link
Copy Markdown
Member

dkurt commented Jul 4, 2023

Hi! Thanks for a proposal, can you please provide a test case which is fixed by these changes?

@dkurt dkurt added pr: needs test New functionality requires minimal tests set category: imgproc labels Jul 4, 2023
@dkurt dkurt removed the pr: needs test New functionality requires minimal tests set label Jul 10, 2023
vrabaud added 3 commits July 10, 2023 17:08
I believe this is a proper fix to opencv#23562

The PR opencv#23754 overwrites data while that should not be the case with
transparent data. The original test is failing because points at the
border do not get computed because they do not have 4 neighbors to be
computed. Still ,we can approximate their computation with whatever
neighbors that are available.
@dkurt
Copy link
Copy Markdown
Member

dkurt commented Jul 10, 2023

@vrabaud, I agree with your proposal, thanks for the contribution!

Let's summarize the behavior. Am I correct that for the border pixels from source image (last row and last col), BORDER_TRANSPRENT considered to work like BORDER_CONSTANT with zero values?

@vrabaud
Copy link
Copy Markdown
Contributor Author

vrabaud commented Jul 11, 2023

@dkurt: kindof. It simply did not consider them (considering them as 0 would have been very ugly because weights were not adapted). So it considered them as whatever but mostly set their weights to 0.

@asmorkalov asmorkalov added this to the 4.9.0 milestone Jul 11, 2023
@asmorkalov asmorkalov merged commit fdfb875 into opencv:4.x Jul 12, 2023
@vrabaud vrabaud deleted the imgwarp branch July 25, 2023 08:42
@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 imgwarp at borders when transparent. opencv#23922

I believe this is a proper fix to opencv#23562

The PR opencv#23754 overwrites data while that should not be the case with transparent data. The original test is failing because points at the border do not get computed because they do not have 4 neighbors to be computed. Still ,we can approximate their computation with whatever neighbors that are available.

### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
Fix imgwarp at borders when transparent. opencv#23922

I believe this is a proper fix to opencv#23562

The PR opencv#23754 overwrites data while that should not be the case with transparent data. The original test is failing because points at the border do not get computed because they do not have 4 neighbors to be computed. Still ,we can approximate their computation with whatever neighbors that are available.

### 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.
- [x] 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.

3 participants