-
-
Notifications
You must be signed in to change notification settings - Fork 55.7k
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
Losing last mat row and column during remap()
with BORDER_TRANSPARENT
#23562
Comments
So try something like that: destination = source.copy()
cv2.remap(source,
map1,
map2,
interpolation=cv2.INTER_LINEAR,
dst=destination,
borderMode=cv2.BORDER_TRANSPARENT)
print(destination.reshape(3, 3))
|
Thanks for the reply. However, I'm not sure what to make of your instruction. If I set destination as a copy of source, the effect I'm describing won't be noticeable, since the pixel values are already set to the expected numbers. Do I get this part wrong?
|
@momasthagnum, please take a look at this proposal: #23754 |
@dkurt, wow great! thanks so much for your effort! 😀 |
Keep inliers for linear remap with BORDER_TRANSPARENT #23754 Address #23562 ### 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 - [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
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.
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.
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
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
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
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
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
System Information
OpenCV python version: 4.7.0
Operating System / Platform: Windows 11
Python revision: 3.10.8
Detailed description
[EDIT: unquoted relevant part of my question..]
Hi,
first off thanks for the great work you guys are doing!
I'll try and break this down with the attached python snippet.
The docs say
and sadly I cannot seem to find much more on this anywhere, so I may be using it wrong. In that case apologies for creating this issue. But my understanding is that in the example code, this should lead to pixels in the destination staying black when trying to map to a pixel in the source that doesn't exist (e.g.
20
). However, in the example, all pixels in the mapping mats exist in the source, but still, the last row and column in the destination always remain0
when usingBORDER_TRANSPARENT
. It works as expected withBORDER_CONSTANT
:BORDER_CONSTANT
BORDER_TRANSPARENT
Steps to reproduce
Issue submission checklist
The text was updated successfully, but these errors were encountered: