文字检测中常用的pyclipper包

1、pyclipper.PyclipperOffset()

参考链接:https://github.com/fonttools/pyclipper
从api接口名称可以看出来应该是做坐标的偏移(多边形的),我们看一个具体的例子(官方提供的例子):
i

mport pyclipper

subj = ((180, 200), (260, 200), (260, 150), (180, 150))

pco = pyclipper.PyclipperOffset()
pco.AddPath(subj, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)

solution = pco.Execute(-7.0)

输出:solution (a list of paths): [[[253, 193], [187, 193], [187, 157], [253, 157]]]
可以看见,在执行pco.Execute(-7.0)这一句之后,上面的坐标的位移发生了变化,(当然这里顺序视乎改变了,我猜测是按照一定的规则重新排列了)


注意:
***The Clipper library uses integers instead of floating point values to preserve numerical robustness.(官方原话,大概是要使用整数)

  • 待续。。。

你可能感兴趣的:(python,python,几何学)