'**SUMMARY**
Smooth the image, by default with the Gaussian blur.  If desired,
additional algorithms and apertures can be specified.  Optional parameters
are passed directly to OpenCV\'s cv.Smooth() function.
If grayscale is true the smoothing operation is only performed on a single channel
otherwise the operation is performed on each channel of the image.
for OpenCV versions >= 2.3.0 it is advisible to take a look at
- :py:meth:`bilateralFilter`
- :py:meth:`medianFilter`
- :py:meth:`blur`
- :py:meth:`gaussianBlur`
**PARAMETERS**
* *algorithm_name* - valid options are \'blur\' or gaussian, \'bilateral\', and \'median\'.
* `Median Filter <http://en.wikipedia.org/wiki/Median_filter>`_
* `Gaussian Blur <http://en.wikipedia.org/wiki/Gaussian_blur>`_
* `Bilateral Filter <http://en.wikipedia.org/wiki/Bilateral_filter>`_
* *aperture* - A tuple for the aperture of the gaussian blur as an (x,y) tuple.
- Note there was rampant spelling mistakes in both smooth & sobel,
aperture is spelled as such, and not "aperature". This code is backwards
compatible.
.. Warning::
These must be odd numbers.
* *sigma* -
* *spatial_sigma* -
* *grayscale* - Return just the grayscale image.
**RETURNS**
The smoothed image.
**EXAMPLE**
>>> img = Image("Lenna")
>>> img2 = img.smooth()
>>> img3 = img.smooth(\'median\')
**SEE ALSO**
:py:meth:`bilateralFilter`
:py:meth:`medianFilter`
:py:meth:`blur`'

def smooth(self, algorithm_name='gaussian', aperture=(3, 3), sigma=0, spatial_sigma=0, grayscale=False, aperature=None):

    aperture = (aperature if aperature else aperture)
    if is_tuple(aperture):
        (win_x, win_y) = aperture
        if ((win_x <= 0) or (win_y <= 0) or ((win_x % 2) == 0) or ((win_y % 2) == 0)):
            logger.warning('The    aperture    (x,y)    must    be    odd    number    and    greater    than    0.')
            return None
    else:
        raise ValueError(('Please    provide    a    tuple    to    aperture,    got:    %s' % type(aperture)))
    if (algorithm_name == 'blur'):
        algorithm = cv.CV_BLUR
    elif (algorithm_name == 'bilateral'):
        algorithm = cv.CV_BILATERAL
        win_y = win_x
    elif (algorithm_name == 'median'):
        algorithm = cv.CV_MEDIAN
        win_y = win_x
    else:
        algorithm = cv.CV_GAUSSIAN
    if grayscale:
        newimg = self.getEmpty(1)
        cv.Smooth(self._getGrayscaleBitmap(), newimg, algorithm, win_x, win_y, sigma, spatial_sigma)
    else:
        newimg = self.getEmpty(3)
        r = self.getEmpty(1)
        g = self.getEmpty(1)
        b = self.getEmpty(1)
        ro = self.getEmpty(1)
        go = self.getEmpty(1)
        bo = self.getEmpty(1)
        cv.Split(self.getBitmap(), b, g, r, None)
        cv.Smooth(r, ro, algorithm, win_x, win_y, sigma, spatial_sigma)
        cv.Smooth(g, go, algorithm, win_x, win_y, sigma, spatial_sigma)
        cv.Smooth(b, bo, algorithm, win_x, win_y, sigma, spatial_sigma)
        cv.Merge(bo, go, ro, None, newimg)
    return Image(newimg, colorSpace=self._colorSpace)
