Repository navigation
Conversation
`imresize` documents `scale_factor` as output / input (e.g. 0.5 halves the image), and the "optimize" interpolation picks `INTER_AREA` below 1.0 and `INTER_CUBIC` otherwise. When only `output_size` was passed, the scale factor was derived as input / output, so every downscale was treated as an upscale and got bicubic interpolation. Derive the scale factor as output / input and add a regression test checking that `output_size` and the equivalent `scale_factor` choose the same interpolation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1173 +/- ##
============================================
+ Coverage 99.91% 100.00% +0.08%
============================================
Files 112 15 -97
Lines 13454 1243 -12211
Branches 1610 0 -1610
============================================
- Hits 13443 1243 -12200
+ Misses 5 0 -5
+ Partials 6 0 -6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
imresizedocumentsscale_factoras output / input (scale_factor=0.5halves the image), and the defaultinterpolation="optimize"usescv2.INTER_AREAbelow 1.0 andcv2.INTER_CUBICotherwise.output_sizewas passed, the scale factor was derived as input / output, so every downscale was treated as an upscale and got bicubic interpolation.output_size=(224, 224)usedINTER_CUBIC, whilescale_factor=0.5on the same image usedINTER_AREA.test_imresize_output_size_interpolation, which checks thatoutput_sizeand the equivalentscale_factorselect the same interpolation for both a downscale and an upscale. The test fails without the fix.