簡體   English   中英

Output 從 tesseract ocr 中提取的文本

[英]Output of the text extracted from tesseract ocr

我正在使用 google tesseract 從圖像中提取文本。 我有一個文件夾,里面有一些圖像,我想以文本文件的形式存儲提取的文本。 結果沒問題,但 output.txt 文件中顯示了一些紅色框。

這是我從文件夾中提取文本的代碼

import cv2
import pytesseract as pt
import os

custom_config = "--oem 3 --psm 6"

path ="/home/rakshit/Documents/textextraction/croped/82092117"

textBox = []
for filename in os.listdir(path):
    head = os.path.split(filename)
    file_name = head[1].split('_',1)[0]

    imagePath = os.path.join(path, filename)
    img = cv2.imread(imagePath)
    text = pt.image_to_string(image, config = custom_config)
    textBox.append(text)

finalPath = f"/home/rakshit/Documents/textextraction/outputText/detected/{file_name}.txt"

with open(finalPath, 'w') as f:
    for t in textBox:
        f.write(t)
        f.write("\n")

output 文本是這樣的: Output 文本文件圖像

誰能告訴我 output 文本文件中出現的這些框是什么? 提前感謝您花時間解決這個問題。

共享文本文件的屏幕圖像不是一個好的方式。 但我猜是分頁符

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM