From aa08e8a559113cdb281d045a83ed400d00a86953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sun, 2 Sep 2012 13:41:25 +0200 Subject: [PATCH] Fix for predefined output array --- skimage/morphology/binary.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/skimage/morphology/binary.py b/skimage/morphology/binary.py index eef31a3d..ffd79482 100644 --- a/skimage/morphology/binary.py +++ b/skimage/morphology/binary.py @@ -29,8 +29,10 @@ def binary_erosion(image, selem, out=None): """ - out = ndimage.convolve(image > 0, selem, output=out, - mode='constant', cval=1) + conv = ndimage.convolve(image > 0, selem, output=out, + mode='constant', cval=1) + if conv is not None: + out = conv return np.equal(out, np.sum(selem), out=out) @@ -62,8 +64,10 @@ def binary_dilation(image, selem, out=None): """ - out = ndimage.convolve(image > 0, selem, output=out, - mode='constant', cval=1) + conv = ndimage.convolve(image > 0, selem, output=out, + mode='constant', cval=1) + if conv is not None: + out = conv return np.not_equal(out, 0, out=out)