From b0437045ed539826757cbb6b5c4daf963b0018d2 Mon Sep 17 00:00:00 2001 From: emmanuelle Date: Wed, 15 Jun 2016 09:23:12 +0200 Subject: [PATCH] Added default value to gaussian filter (sigma parameter) --- skimage/filters/_gaussian.py | 4 ++-- skimage/filters/tests/test_gaussian.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/skimage/filters/_gaussian.py b/skimage/filters/_gaussian.py index 2a455fe9..d94c8942 100644 --- a/skimage/filters/_gaussian.py +++ b/skimage/filters/_gaussian.py @@ -9,7 +9,7 @@ from .._shared.utils import warn __all__ = ['gaussian'] -def gaussian(image, sigma, output=None, mode='nearest', cval=0, +def gaussian(image, sigma=1, output=None, mode='nearest', cval=0, multichannel=None): """Multi-dimensional Gaussian filter @@ -17,7 +17,7 @@ def gaussian(image, sigma, output=None, mode='nearest', cval=0, ---------- image : array-like input image (grayscale or color) to filter. - sigma : scalar or sequence of scalars + sigma : scalar or sequence of scalars, optional standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for diff --git a/skimage/filters/tests/test_gaussian.py b/skimage/filters/tests/test_gaussian.py index 2d78ce6c..da69fab0 100644 --- a/skimage/filters/tests/test_gaussian.py +++ b/skimage/filters/tests/test_gaussian.py @@ -19,6 +19,12 @@ def test_null_sigma(): assert np.all(gaussian(a, 0) == a) +def test_default_sigma(): + a = np.zeros((3, 3)) + a[1, 1] = 1. + assert np.all(gaussian(a) == gaussian(a, sigma=1)) + + def test_energy_decrease(): a = np.zeros((3, 3)) a[1, 1] = 1.