Shortcuts

mmocr.utils.offset_polygon

mmocr.utils.offset_polygon(poly, distance)[源代码]

Offset (expand/shrink) the polygon by the target distance. It’s a wrapper around pyclipper based on Vatti clipping algorithm.

警告

Polygon coordinates will be casted to int type in PyClipper. Mind the potential precision loss caused by the casting.

参数
  • poly (ArrayLike) – A polygon. In any form can be converted to an 1-D numpy array. E.g. list[float], np.ndarray, or torch.Tensor. Polygon is written in [x1, y1, x2, y2, …].

  • distance (float) – The offset distance. Positive value means expanding, negative value means shrinking.

返回

1-D Offsetted polygon ndarray in float32 type. If the result polygon is invalid or has been split into several parts, return an empty array.

返回类型

np.array

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.