-
Notifications
You must be signed in to change notification settings - Fork 568
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
Use clamp wrap mode for IBA::resample() #2481
Use clamp wrap mode for IBA::resample() #2481
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is overall great and exactly what I hoped for. See the comments I made about parameter order (for uniformity with everything else), and to decide on the issue of link vs source back-compatibility (i.e., whether we need to backport or not).
You did resample and fit... maybe we should tackle resize in the same PR so they all continue to match?
Thanks! This is very close to finished and I appreciate your sending the PR. |
|
… list of functions getting a wrap argument
I might be wrong, but the tests may be failing (it's somewhat hard for me to run them where I am currently), because I'm passing the wrap mode into resize via fit, rather than hardcoding the wrap to be WrapClamp. If this is the case, I'm guessing, it would be preferable to hardcode WrapClamp in fit? Alternatively we could remove resize from having the option wrap option all together. |
Hmmm, now this is all less obvious. So the original problem you started with is that resample was getting black fringing because -- unlike resize, which was hard-coded to use clamp wrap mode -- resample was not specifying wrap and thus getting black wrap. Fit was even weirder -- it looks like it was calling warp with black wrap for the "exact" mode, but calling resize (and thus implicitly using clamp) for the default "inexact" mode. Now I don't know the right answer. Outstanding questions:
I think that if more than one of them allow an optional user-set wrap mode, they should all have the same default, or it's confusing. People think of resample as a less exact and faster version of resample, and fit as a version of resize that forces an overall frame aspect ratio and letterboxes to make it right. Was resize right all along and the others should just hard-code clamp as well to match (leaving only the fully general |
I'm going to need to think about this one... |
I think... maybe the best thing to do is radically scale back the ambition of this PR, and just make it so that resample() hard-codes its call to interppixel to pass the 'WrapClamp' wrap mode, to match the behavior of resize(). I don't think that we need to change any of the public APIs or add new parameters, unless somebody make a strong case for the current behavior of resize or fit is not sensible or needs another parameter that uses will need to ponder every time they use it. Sorry to ask you to back off much of the work you did. Sometimes that's just the way it works out. I think I've thrown away more of my own code that I've committed over the years. |
I have to admit, that was my initial thought, but figured someone somewhere may want black edges to contribute? Would it be worth updating fit aswell (so as to stop asymmetry)? That's absolutely fine, I'm the first to throw away everything in favour of a better solution :) Fingers crossed this doesn't break any of the tests (or anyones existing code). |
I edited the subject title of the ticket so that it would be more clear what it ultimately did, for anybody browsing the closed PRs. |
To avoid the black fringing and match the behavior of resize().
Description
This PR addresses #2480 and #2479
As mentioned in the tickets, I simply added a wrap argument.
This should hopefully not break any existing code, as I've added wrappers to match the previous signatures.
Checklist:
have previously submitted a Contributor License Agreement
(individual, and if there is any way my
employers might think my programming belongs to them, then also
corporate).
(adding new test cases if necessary).