如何获得文本中字体的旋转角度,只要得到度数,拜托 #14984
Unanswered
liyanluxintong
asked this question in
Q&A
Replies: 1 comment 2 replies
-
要获取文本的旋转角度(即字体的旋转度数),你可以启用 PaddleOCR 中的文本方向分类器(cls)模块,它可以帮助预测文本方向角度,并返回角度信息。根据你提供的文档内容,已在 args.cpp 中启用了 cls 参数: DEFINE_bool(cls, true, "Whether use cls in forward."); // 开启cls
DEFINE_bool(use_angle_cls, true, "Whether use use_angle_cls."); 这样在推理过程中,PaddleOCR 会自动调用文本方向分类模型(方向分类器),并给出角度方向分类。输出中可以拿到预测的角度。注意以下几点:
以下是一些提升和提取文字角度的建议: ✅ 启用方向分类器并观察输出是否包含角度:
✅ 如果你只需要角度而不进行全文识别,可以只使用方向分类器模型跑推理过程,输出角度信息即可。 相关讨论贴参考: 如仍无法获取角度值,建议使用 Python 接口运行逻辑更简单的: from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, use_gpu=False)
result = ocr.ocr('你图片路径')[0]
for line in result:
angle = line[1][2].get('angle', None)
if angle is not None:
print("旋转角度:", angle) 希望这些信息能帮你成功提取字体旋转角度(度数)。 Response generated by 🤖 feifei-bot | chatgpt-4o-latest |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
如何获得文本中字体的旋转角度,只要得到度数,拜托
Beta Was this translation helpful? Give feedback.
All reactions