Change binary morphology functions to output numpy.bool dtype

This commit is contained in:
Nelson Brown
2014-07-13 19:59:43 -07:00
parent b677c400df
commit a1519a015e
2 changed files with 42 additions and 2 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ def binary_erosion(image, selem=None, out=None):
ndimage.convolve(binary, selem, mode='constant', cval=1, output=conv)
if out is None:
out = conv
out = np.empty_like(conv, dtype=np.bool)
return np.equal(conv, selem_sum, out=out)
@@ -98,7 +98,7 @@ def binary_dilation(image, selem=None, out=None):
ndimage.convolve(binary, selem, mode='constant', cval=0, output=conv)
if out is None:
out = conv
out = np.empty_like(conv, dtype=np.bool)
return np.not_equal(conv, 0, out=out)