def calculate_board_dim(img_mat, start_pos):
    """
    Calculates the length of one side of the board (all info we need to find specific tiles)
    """
    x, y = start_pos
    dim = 0  # size of one side of the chess board
    while img_mat[x, y, 0] != 0 and img_mat[x, y, 1] != 0 and img_mat[x, y, 0] != 0:
        dim += 1
        x += 1  # move one pixel to the right until we hit black one
    return dim