def center_surround(fov, fov_horz_span, fov_vert_span, verbose=False): 
    fov_height = fov.shape[0]
    fov_width = fov.shape[1]
    block_width = float(fov_width) / float(fov_horz_span + 2)
    block_height = float(fov_height) / float(fov_vert_span + 2)
    super_pixels = np.zeros((fov_vert_span + 2, fov_horz_span + 2))
    center_surround_pixels = np.zeros((fov_vert_span, fov_horz_span))
    # Create the superpixels by averaging pixel blocks
    for row in range(fov_vert_span + 2):
        for col in range(fov_horz_span + 2):
            super_pixels[row][col] = np.mean(
                    fov[int(float(row)     * block_height): 
                        int(float(row + 1) * block_height),
                        int(float(col)     * block_width) : 
                        int(float(col + 1) * block_width) ])
    for row in range(fov_vert_span):
        for col in range(fov_horz_span):
            # Calculate a center-surround value that represents
            # the difference between the pixel and its surroundings.
            # Weight the N, S, E, and W pixels by 1/6 and
            # the NW, NE, SW, and SE pixels by 1/12, and 
            # subtract from the center.
            center_surround_pixels[row][col] = (
                    super_pixels[row + 1][col + 1] -
                    super_pixels[row    ][col + 1] / 6 -
                    super_pixels[row + 2][col + 1] / 6 -
                    super_pixels[row + 1][col    ] / 6 -
                    super_pixels[row + 1][col + 2] / 6 -
                    super_pixels[row    ][col    ] / 12 -
                    super_pixels[row + 2][col    ] / 12 -
                    super_pixels[row    ][col + 2] / 12 -
                    super_pixels[row + 2][col + 2] / 12)
    if verbose:
        # Display the field of view clipped from the original image
        plt.figure("fov")
        plt.gray()
        im = plt.imshow(fov)
        im.set_interpolation('nearest')
        plt.title("field of view")
        plt.draw() 
        # Display the pixelized version, a.k.a. superpixels
        plt.figure("super_pixels")
        plt.gray()
        im = plt.imshow(super_pixels)
        im.set_interpolation('nearest')
        plt.title("super pixels")
        plt.draw() 
        # Display the center-surround filtered superpixels
        plt.figure("center_surround_pixels")
        plt.gray()
        im = plt.imshow(center_surround_pixels)
        im.set_interpolation('nearest')
        plt.title("center surround pixels")
        plt.draw() 
    return center_surround_pixels
Return the union of graphs G and H.
dataset/ETHPy150Open matt2000/becca/worlds/world_tools.py/center_surround--crossover with--dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/operators/binary.py/union