change_coordinate_frame#

change_coordinate_frame(boxlist: NpBoxList, window: ndarray) NpBoxList[source]#

Change coordinate frame of the boxlist to be relative to window’s frame.

Given a window of the form [ymin, xmin, ymax, xmax], changes bounding box coordinates from boxlist to be relative to this window (e.g., the min corner maps to (0,0) and the max corner maps to (1,1)). An example use case is data augmentation: where we are given groundtruth boxes (boxlist) and would like to randomly crop the image to some window (window). In this case we need to change the coordinate frame of each groundtruth box to be relative to this new window.

Parameters:
  • boxlist (NpBoxList) – A BoxList object holding N boxes.

  • window (ndarray) – a size 4 1-D numpy array.

Returns:

Returns a BoxList object with N boxes.

Return type:

BoxList