Beispiel #1
0
def pixel_func(img, kernel):
    mid = get_middle(kernel)
    weight = GeneratePixelGauss(img, mid)
    # need to normalize and apply cross correlation
    weight_norm = custom_utils.norml_mtx(weight)
    apply_weights = custom_utils.sum_cross_mtx(img, weight_norm)
    return apply_weights
Beispiel #2
0
def DistanceFilter(img):
    win = np.array(BLUR33).astype(np.float)
    # normalize the window and apply convolution with zero padding
    win = custom_utils.norml_mtx(win)
    blurred = filters.convolve(img, win, mode='constant', cval=0)
    # clip to ensure grayscale values
    blurred = np.clip(blurred, 0, 1)
    return blurred
Beispiel #3
0
def combo_func(img, kernel):
    mid = get_middle(kernel)
    # generate pixel gaussian
    pixel = GeneratePixelGauss(img, mid)
    # combine with distance gaussian
    dist = np.array(BLUR33).astype(np.float)
    weight = pixel * dist
    # apply the new window
    weight_norm = custom_utils.norml_mtx(weight)
    apply_weights = custom_utils.sum_cross_mtx(img, weight_norm)
    return apply_weights