def extract_grid_blocks(img, blocks_per_image=(3, 3)):
    """
    Divide image into grids(blocks)
    :param img: input 1-channel image
    :param blocks_per_image: number of grids in tuple(height, width)
    :return: 2D list containing pixel value for each slot
    """
    img_height, img_width = img.shape[0], img.shape[1]
    bx = int(img_width / blocks_per_image[1])
    by = int(img_height / blocks_per_image[0])
    grids = []
    for i in range(blocks_per_image[0]):
        start_i = i * by
        end_i = start_i + by
        for j in range(blocks_per_image[1]):
            start_j = j * bx
            end_j = start_j + bx
            grid = img[start_i:end_i, start_j:end_j]
            grids.append(grid)

    return grids