Fix bug in warp which caused 1 pixel images not to be clipped

This commit is contained in:
Johannes Schönberger
2012-10-06 15:21:26 +02:00
committed by Stefan van der Walt
parent 11b742ca28
commit e2dec8339c
+4 -3
View File
@@ -1015,7 +1015,8 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
if mode == 'constant' and not (0 <= cval <= 1):
clipped[out == cval] = cval
if clipped.shape[0] == 1 or clipped.shape[1] == 1:
if clipped.ndim == 3 and orig_ndim == 2:
# remove singleton dim introduced by atleast_3d
return clipped[..., 0]
else:
return clipped
else: # remove singleton dim introduced by atleast_3d
return clipped.squeeze()