def mnormalize(matrix):
    """Scale a matrix according to the value in the center."""
    width = len(matrix[0])
    height = len(matrix)
    factor = 1.0 / matrix[int(height / 2)][int(width / 2)]
    if 1.0 == factor:
        return matrix
    for i in range(height):
        for j in range(width):
            matrix[i][j] *= factor
    return matrix