Pytesseract OCR 检测路径点的小数

问题描述 投票:0回答:1

我正在尝试像这样 OCR 路径点的图像,并且我希望输出与图像完全相同。

enter image description here

这是我的代码:

import pytesseract as tess
from PIL import Image
import cv2

# Set Tesseract executable path
tess.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"

img = cv2.imread("wp1.png")
text = tess.image_to_string(img)

我得到了垂直输出,但我希望它水平显示。

我想在同一行输出类似 lats long Alt 的格式。

python opencv decimal ocr python-tesseract
1个回答
0
投票

您的图像不是最佳的,但如果您像文档描述的那样使用它,您会得到三列:

import cv2 
import pytesseract

img = cv2.imread('wp1.png')

custom_config = r'--oem 3 --psm 6'
text = pytesseract.image_to_string(img, config=custom_config)
print(text)

你得到:

-35.363219 149.164976 577.419983
-35.357360 149.163171 10.000000
-35.364753 149.155083 10000000
-35.369599 149.166029 10000000
...
© www.soinside.com 2019 - 2024. All rights reserved.