mmocr.utils¶
Box Utils¶
Converting a bounding box to a polygon. |
|
Calculate the distance between the center points of two bounding boxes. |
|
Calculate the diagonal length of a bounding box (distance between the top-left and bottom-right). |
|
Sample points from the boundary of a polygon enclosed by two Bezier curves, which are controlled by |
|
Check if two boxes are on the same line by their y-axis coordinates. |
|
Rescale bboxes according to scale_factor. |
|
Stitch fragmented boxes of words into lines. |
Point Utils¶
Calculate the distance between two points. |
|
Calculate the center of a set of points. |
Polygon Utils¶
Calculate the IOU between two boundaries. |
|
Crop polygon to be within a box region. |
|
Check if the polygon is inside the target region. |
|
Offset (expand/shrink) the polygon by the target distance. |
|
Converting a polygon to a bounding box. |
|
Convert a polygon to shapely.geometry.Polygon. |
|
Calculate the intersection area between two polygons. |
|
Calculate the IOU between two polygons. |
|
Convert a potentially invalid polygon to a valid one by eliminating self-crossing or self-touching parts. |
|
Calculate the union area between two polygons. |
|
Convert a nested list of boundaries to a list of Polygons. |
|
Rescale a polygon according to scale_factor. |
|
Rescale polygons according to scale_factor. |
|
Convert a nested list of boundaries to a list of Polygons. |
|
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 box vertices in clockwise order from left-top first. |
|
Sort vertex with 8 points [x1 y1 x2 y2 x3 y3 x4 y4] |
Mask Utils¶
Fill holes in matrix. |
Misc Utils¶
check x is 2d-list([[1], []]) or 1d empty list([]). |
|
check x is 3d-list([[[1], []]]) or 2d empty list([[], []]) or 1d empty list([]). |
|