Shortcuts

mmocr.utils.crop_polygon

mmocr.utils.crop_polygon(polygon, crop_box)[source]

Crop polygon to be within a box region.

Parameters
  • polygon (ndarray) – polygon in shape (N, ).

  • crop_box (ndarray) – target box region in shape (4, ).

Returns

Cropped polygon. If the polygon is not within the

crop box, return None.

Return type

np.array or None