Skip to content

ndimage: add grid_mode option to zoom - #4401

Merged
takagi merged 9 commits into
cupy:masterfrom
grlee77:ndimage_boundary_grid_zoom
Dec 21, 2020
Merged

takagi merged 9 commits into
cupy:masterfrom
grlee77:ndimage_boundary_grid_zoom

Conversation

@grlee77

@grlee77 grlee77 commented Dec 3, 2020

Copy link
Copy Markdown
Member

blocked by #4400 (This PR builds on that one. Only the final "ENH: implement grid_mode parameter for zoom" commit here is new)

This PR implements zooming in a manner consistent with scikit-image's resize and OpenCV's cv2.resize. See further explanation in the corresponding SciPy PR scipy/scipy#13095 (to be released in SciPy 1.6).

Basically the issue relates to whether coordinate (0, 0) is at the center or corner of a pixel. In the kernel, this translates into computing coordinates via:
c = zoom * (in_coord + 0.5) - 0.5 (for grid_mode=True)
vs.
c = zoom * in_coord (for grid_mode=False)

@grlee77 grlee77 changed the title add grid_mode option to ndimage.zoom ndimage: add grid_mode option to zoom Dec 4, 2020
@kmaehashi kmaehashi added cat:enhancement Improvements to existing features prio:medium st:blocked-by-another-pr Blocked by another pull-request labels Dec 4, 2020
The changes here are consistent with a large number of fixes introduced for SciPy 1.6
Specifically this PR includes order=1 and order=0 fixes from
SciPy's gh-12767 and gh-12776
STYLE: f-strings in _spline_prefilter_core.py

pep 8 fixes
All ndimage test cases now verified to pass when using SciPy 1.6.0 pre-release code
@grlee77
grlee77 force-pushed the ndimage_boundary_grid_zoom branch from 9b08aea to 336e5c2 Compare December 10, 2020 03:14
@takagi

takagi commented Dec 17, 2020

Copy link
Copy Markdown
Contributor

pfnCI, test this please.

@chainer-ci

Copy link
Copy Markdown
Member

Jenkins CI test (for commit e23dd31, target branch master) succeeded!

@takagi

takagi commented Dec 18, 2020

Copy link
Copy Markdown
Contributor

As well as #4400, would you mark cupy.experimental if grid_mode is supplied by the user. LGTM except for that.

@grlee77
grlee77 force-pushed the ndimage_boundary_grid_zoom branch from e23dd31 to dccd261 Compare December 18, 2020 20:54
@grlee77

grlee77 commented Dec 18, 2020

Copy link
Copy Markdown
Member Author

Thanks for reviewing @takagi, I have added the experimental marker here and in #4400

@takagi

takagi commented Dec 21, 2020

Copy link
Copy Markdown
Contributor

pfnCI, test this please.

@takagi

takagi commented Dec 21, 2020

Copy link
Copy Markdown
Contributor

Thanks! I'll mrege this with following #4400 .

@chainer-ci

Copy link
Copy Markdown
Member

Jenkins CI test (for commit ddc31ab, target branch master) succeeded!

@takagi takagi removed the st:blocked-by-another-pr Blocked by another pull-request label Dec 21, 2020
@takagi takagi added this to the v9.0.0b1 milestone Dec 21, 2020
@takagi
takagi merged commit ef6d007 into cupy:master Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:enhancement Improvements to existing features prio:medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants