ssim/utils.py
def get_gaussian_kernel(gaussian_kernel_width=11, gaussian_kernel_sigma=1.5):
    """Generate a gaussian kernel."""
    # 1D Gaussian kernel definition
    gaussian_kernel_1d = numpy.ndarray((gaussian_kernel_width))
    norm_mu = int(gaussian_kernel_width / 2)

    # Fill Gaussian kernel
    for i in range(gaussian_kernel_width):
        gaussian_kernel_1d[i] = (exp(-(((i - norm_mu) ** 2)) /
                                     (2 * (gaussian_kernel_sigma ** 2))))
    return gaussian_kernel_1d / numpy.sum(gaussian_kernel_1d)
def get_gaussian_kernel(gaussian_kernel_width=11, gaussian_kernel_sigma=1.5):
    # 1D Gaussian kernel definition
    gaussian_kernel_1d = numpy.ndarray((gaussian_kernel_width))
    norm_mu = int(gaussian_kernel_width / 2)

    # Fill Gaussian kernel
    for i in range(gaussian_kernel_width):
        gaussian_kernel_1d[i] = (exp(-(((i - norm_mu) ** 2)) /
                                     (2 * (gaussian_kernel_sigma ** 2))))
    return gaussian_kernel_1d / numpy.sum(gaussian_kernel_1d)
def get_gaussian_kernel ( gaussian_kernel_width = 11 , gaussian_kernel_sigma = 1.5 ) : # 1D Gaussian kernel definition gaussian_kernel_1d = numpy . ndarray ( ( gaussian_kernel_width ) ) norm_mu = int ( gaussian_kernel_width / 2 ) # Fill Gaussian kernel for i in range ( gaussian_kernel_width ) : gaussian_kernel_1d [ i ] = ( exp ( - ( ( ( i - norm_mu ) ** 2 ) ) / ( 2 * ( gaussian_kernel_sigma ** 2 ) ) ) ) return gaussian_kernel_1d / numpy . sum ( gaussian_kernel_1d )
Generate a gaussian kernel.
Generate a gaussian kernel .