Shortcuts

mmocr.utils

Box Utils

bbox2poly

Converting a bounding box to a polygon.

bbox_center_distance

Calculate the distance between the center points of two bounding boxes.

bbox_diag_distance

Calculate the diagonal length of a bounding box (distance between the top-left and bottom-right).

bezier2polygon

Sample points from the boundary of a polygon enclosed by two Bezier curves, which are controlled by bezier_points.

is_on_same_line

Check if two boxes are on the same line by their y-axis coordinates.

rescale_bboxes

Rescale bboxes according to scale_factor.

stitch_boxes_into_lines

Stitch fragmented boxes of words into lines.

Point Utils

point_distance

Calculate the distance between two points.

points_center

Calculate the center of a set of points.

Polygon Utils

boundary_iou

Calculate the IOU between two boundaries.

crop_polygon

Crop polygon to be within a box region.

is_poly_inside_rect

Check if the polygon is inside the target region.

offset_polygon

Offset (expand/shrink) the polygon by the target distance.

poly2bbox

Converting a polygon to a bounding box.

poly2shapely

Convert a polygon to shapely.geometry.Polygon.

poly_intersection

Calculate the intersection area between two polygons.

poly_iou

Calculate the IOU between two polygons.

poly_make_valid

Convert a potentially invalid polygon to a valid one by eliminating self-crossing or self-touching parts.

poly_union

Calculate the union area between two polygons.

polys2shapely

Convert a nested list of boundaries to a list of Polygons.

rescale_polygon

Rescale a polygon according to scale_factor.

rescale_polygons

Rescale polygons according to scale_factor.

shapely2poly

Convert a nested list of boundaries to a list of Polygons.

sort_points

Sort arbitrary points in clockwise order in Cartesian coordinate, you may need to reverse the output sequence if you are using OpenCV’s image coordinate.

sort_vertex

Sort box vertices in clockwise order from left-top first.

sort_vertex8

Sort vertex with 8 points [x1 y1 x2 y2 x3 y3 x4 y4]

Mask Utils

fill_hole

Fill holes in matrix.

Misc Utils

equal_len

is_2dlist

check x is 2d-list([[1], []]) or 1d empty list([]).

is_3dlist

check x is 3d-list([[[1], []]]) or 2d empty list([[], []]) or 1d empty list([]).

is_none_or_type

is_type_list

Setup Env

register_all_modules

Register all modules in mmocr into the registries.

Read the Docs v: latest
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.