def calculate_boundbox(list_coordinates):
    """
    coordinates are inverted  x: colums y :rows


    list_coordinates: list of the form [ [x2,y1], [x2,y2], . . .    ]

    returns top  left point (x,y) and width (w) and heigth (h) of rectangle 

    """
  
    x = int(min(list_coordinates[:,0]))
    y = int(min(list_coordinates[:,1]))

    w  =int(max(list_coordinates[:,0]) - x)
    h = int(max(list_coordinates[:,1]) - y)

  
    return x,y,w,h