mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-07 08:00:02 +08:00
FIX: transform.warp supports cval outside 0-1 range
This commit is contained in:
committed by
Johannes Schönberger
parent
1ac289c588
commit
0749f8d9f0
@@ -785,4 +785,9 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
|
||||
# The spline filters sometimes return results outside [0, 1],
|
||||
# so clip to ensure valid data
|
||||
return np.clip(mapped.squeeze(), 0, 1)
|
||||
clipped = np.clip(mapped, 0, 1)
|
||||
if mode == 'constant' and not (0 <= cval <= 1):
|
||||
clipped[mapped == cval] = cval
|
||||
|
||||
# Remove singleton dim introduced by atleast_3d
|
||||
return clipped.squeeze()
|
||||
|
||||
Reference in New Issue
Block a user