Added test case for warp() when cval out of clipping range

This commit is contained in:
James Bergstra
2012-08-24 00:16:30 +02:00
committed by Johannes Schönberger
parent 0749f8d9f0
commit e710fac03e
2 changed files with 10 additions and 1 deletions
+1
View File
@@ -786,6 +786,7 @@ 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
clipped = np.clip(mapped, 0, 1)
if mode == 'constant' and not (0 <= cval <= 1):
clipped[mapped == cval] = cval