Skip to content
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

Fix rescale using small scale factor #5256

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

rfezzani
Copy link
Member

@rfezzani rfezzani commented Mar 2, 2021

Description

Fixes #5252.

The proposed fix is to return a 1 pixel image when a very small scale factor is used for rescaling an image:

>>> img = zeros((2, 2))
>>> out = rescale(img, 0.1)  # current behavior is to raise an error as reported in #5252
>>> print(out)  # with this PR
[[0.]]

An other option would be to raise a proper error message instead of the actual OverflowError. What do you, reviewers, prefer?

Checklist

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

@rfezzani rfezzani added the 🩹 type: Bug fix Fixes unexpected or incorrect behavior label Mar 2, 2021
Copy link
Member

@jni jni left a comment

Choose a reason for hiding this comment

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

neat! 😊

@mkcor mkcor merged commit ef5cfc3 into scikit-image:main Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🩹 type: Bug fix Fixes unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

skimage.transform.rescale fails for scale < 0.2
3 participants