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

108-resize #125

Merged
merged 6 commits into from
Mar 5, 2020
Merged

108-resize #125

merged 6 commits into from
Mar 5, 2020

Conversation

madil90
Copy link
Contributor

@madil90 madil90 commented Feb 28, 2020

Fixes #108 .

Description

Resize an image (Spatial Scale). Tests coming soon.

Status

Work in progress

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or new feature that would cause existing functionality to change)
  • New tests added to cover the changes
  • Docstrings/Documentation updated

@madil90
Copy link
Contributor Author

madil90 commented Feb 28, 2020

@wyli Tests will be added to PR soon.

@madil90
Copy link
Contributor Author

madil90 commented Feb 28, 2020

@wyli @ericspod By default, skimage.transform.rotate sets preserve_range to False. What happens is

img = np.arange(48).reshape(3, 4, 4)
res = rotate(img, 180, preserve_range=False)

outputs

[[[4.82469967e-18 4.93311988e-18 5.04154010e-18 5.14996032e-18]
[4.39101880e-18 4.49943902e-18 4.60785923e-18 4.71627945e-18]
[3.95733793e-18 4.06575815e-18 4.17417836e-18 4.28259858e-18]
[3.52365706e-18 3.63207728e-18 3.74049750e-18 3.84891771e-18]]

[[3.08997619e-18 3.19839641e-18 3.30681663e-18 3.41523684e-18]
[2.65629532e-18 2.76471554e-18 2.87313576e-18 2.98155597e-18]
[2.22261445e-18 2.33103467e-18 2.43945489e-18 2.54787511e-18]
[1.78893358e-18 1.89735380e-18 2.00577402e-18 2.11419424e-18]]

[[1.35525272e-18 1.46367293e-18 1.57209315e-18 1.68051337e-18]
[9.21571847e-19 1.02999206e-18 1.13841228e-18 1.24683250e-18]
[4.87890978e-19 5.96311195e-19 7.04731412e-19 8.13151629e-19]
[5.42101086e-20 1.62630326e-19 2.71050543e-19 3.79470760e-19]]]

I think this is misleading behavior. By default preserve_range should be True so

img = np.arange(48).reshape(3, 4, 4)
res = rotate(img, 180, preserve_range=True)

outputs

[[[44. 45. 46. 47.]
[40. 41. 42. 43.]
[36. 37. 38. 39.]
[32. 33. 34. 35.]]

[[28. 29. 30. 31.]
[24. 25. 26. 27.]
[20. 21. 22. 23.]
[16. 17. 18. 19.]]

[[12. 13. 14. 15.]
[ 8. 9. 10. 11.]
[ 4. 5. 6. 7.]
[ 0. 1. 2. 3.]]]

@madil90 madil90 mentioned this pull request Feb 28, 2020
4 tasks
Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

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

I think preserve_range should be by default True, that seems like expected behaviour.

@madil90 madil90 force-pushed the 108-resize branch 2 times, most recently from 0561e7c to d0a5244 Compare March 3, 2020 09:09
Copy link
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Added comments inline.
Thanks.

@madil90 madil90 changed the title Add Resize transform 108-resize Mar 4, 2020
Copy link
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Added comments inline.

@Nic-Ma Nic-Ma self-requested a review March 5, 2020 09:01
Copy link
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@wyli wyli merged commit f39e8c1 into master Mar 5, 2020
@wyli wyli deleted the 108-resize branch April 6, 2020 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port spatial scaling transform
4 participants