Skip to content

Keep inliers for linear remap with BORDER_TRANSPARENT#23754

Merged
asmorkalov merged 3 commits intoopencv:4.xfrom
dkurt:remap_linear_transparent
Jun 16, 2023
Merged

Keep inliers for linear remap with BORDER_TRANSPARENT#23754
asmorkalov merged 3 commits intoopencv:4.xfrom
dkurt:remap_linear_transparent

Conversation

@dkurt
Copy link
Copy Markdown
Member

@dkurt dkurt commented Jun 6, 2023

Pull Request Readiness Checklist

resolves #23562

I do think that this is a bug because with INTER_CUBIC + BORDER_TRANSPARENT the last column and row are preserved. So same should be done for INTER_LINEAR

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

if( borderType == BORDER_TRANSPARENT && cn != 3 )
{
int sx = XY[dx*2], sy = XY[dx*2+1];
if ((unsigned)sx == width1 || (unsigned)sy == height1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, we have strange code above:

#if CV_SIMD128
    if( _src.type() == CV_8UC3 )
        width1 = std::max(ssize.width-2, 0);
#endif

Why do we guard processing of common variables in SIMD mode only?

/cc @vpisarev That commit is very old: https://github.com/opencv/opencv/blame/fdd83e5027cab3dcbc6acb321ca9c294b90f17e1/modules/imgproc/src/imgwarp.cpp#L663


Code condition is strange too: borderType == BORDER_TRANSPARENT && cn != 3. Why is cn used here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code condition is strange too: borderType == BORDER_TRANSPARENT && cn != 3. Why is cn used here?

Removed that limitation and modified test correspondingly

@dkurt dkurt marked this pull request as ready for review June 7, 2023 11:13
@asmorkalov asmorkalov requested a review from opencv-alalek June 8, 2023 15:45
@asmorkalov asmorkalov added this to the 4.8.0 milestone Jun 8, 2023
@asmorkalov asmorkalov requested a review from vpisarev June 16, 2023 08:28
@asmorkalov asmorkalov merged commit ec95efc into opencv:4.x Jun 16, 2023
vrabaud added a commit to vrabaud/opencv that referenced this pull request Jul 4, 2023
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.
vrabaud added a commit to vrabaud/opencv that referenced this pull request Jul 10, 2023
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.
asmorkalov pushed a commit that referenced this pull request Jul 12, 2023
Fix imgwarp at borders when transparent. #23922

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

- [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
@asmorkalov asmorkalov mentioned this pull request Jul 27, 2023
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
Keep inliers for linear remap with BORDER_TRANSPARENT opencv#23754

Address opencv#23562

### Pull Request Readiness Checklist

resolves opencv#23562

I do think that this is a bug because with `INTER_CUBIC + BORDER_TRANSPARENT` the last column and row are preserved. So same should be done for `INTER_LINEAR`

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 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
Keep inliers for linear remap with BORDER_TRANSPARENT opencv#23754

Address opencv#23562

### Pull Request Readiness Checklist

resolves opencv#23562

I do think that this is a bug because with `INTER_CUBIC + BORDER_TRANSPARENT` the last column and row are preserved. So same should be done for `INTER_LINEAR`

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.

Losing last mat row and column during remap() with BORDER_TRANSPARENT

4 participants