def filt(sub_image, kernel):
    """filt, filt a sub_image with kernel, sub_image and kernel **must** be the same size.
    Inputs:
        sub_image:
        kernel: np.array like, the kernel of the filter
    Return:
        pixel: a pixel value
    """
    assert kernel.shape[0] == kernel.shape[1]
    assert sub_image.shape == kernel.shape

    F = kernel.shape[0]

    pixel = 0
    for f1 in range(F):
        for f2 in range(F):
            pixel += sub_image[f1, f2] * kernel[f1, f2]

    return pixel