在pytesseract的上下文中,在配置tesseract以識別單位數字和限制單個數字和限制輸出對數字可能會提出質疑。 To address this issue, we delve into the specifics of Tesseract's configuration options.
Tesseract Page Segmentation Modes
Tesseract offers various page segmentation modes (psm) to handle diverse text layouts.對於單個字符識別,合適的PSM為10。此模式將圖像視為單個字符。 將數字限制為數字,我們可以利用tessedit_char_char_char_char_whitelist configuration參數。通過將0123456789指定為白名單,Tesseract將僅接受這些字符。
示例示例示例usage示例是image_to_string的示例,具有image_to_string,具有多個配置選項: lang ='eng',box = false, config =' - PSM 10 -OEM 3 -C TESSEDIT_CHAR_WHITELIST = 0123456789')
通過將PSM設置為10並使用字符Whitelist,此配置可確保Tesseract可以識別單個數字,同時將輸出限制為數值。此外,Lang指定語言,框禁用文本框邊界,OEM選擇了OCR引擎。
免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。
Copyright© 2022 湘ICP备2022001581号-3