bounding_box

menpo.shape.bounding_box(closest_to_origin, opposite_corner)[source]

Return a bounding box from two corner points as a directed graph. The the first point (0) should be nearest the origin. In the case of an image, this ordering would appear as:

0<--3
|   ^
|   |
v   |
1-->2

In the case of a pointcloud, the ordering will appear as:

3<--2
|   ^
|   |
v   |
0-->1
Parameters:
  • closest_to_origin ((float, float)) – Two floats representing the coordinates closest to the origin. Represented by (0) in the graph above. For an image, this will be the top left. For a pointcloud, this will be the bottom left.
  • opposite_corner ((float, float)) – Two floats representing the coordinates opposite the corner closest to the origin. Represented by (2) in the graph above. For an image, this will be the bottom right. For a pointcloud, this will be the top right.
Returns:

bounding_box (PointDirectedGraph) – The axis aligned bounding box from the two given corners.