tesseract-OCR4.00 dev VS2015 安装编译
编译教程参考:https://github.com/tesseract-ocr/tesseract/wiki/Compiling#windows
- 下载最新的CPPAN,将cppan.exe所在的文件路径作为环境变量的值。
- 下载最新的cmake,解压文件压缩包,将解压后目录下的bin文件夹的目录地址加载至系统环境变量PATH中。
- 下载Tesseract最新版的源码:git clone https://github.com/tesseract-ocr/tesseract tesseract
- 执行以下命令,编译:
- cd tesseract
- mkdir win64 && cd win64
- cppan ..
- cmake .. -G "Visual Studio 14 2015 Win64"
- cppan --generate .
- 在win64目录下找到tesseract.sln文件,用VS2015打开该文件,点击【生成】按钮,根据相应错误进行改错。
Tess4.0 常用命令
tesseract::PageSegMode
- PSM_OSD_ONLY, ///< Orientation and script detection only. 定位和脚本检测
- PSM_AUTO_OSD, ///< Automatic page segmentation with orientation and < script detection. (OSD) 自动定位、检测、分割
- PSM_AUTO_ONLY, ///< Automatic page segmentation, but no OSD, or OCR. 自动(仅)分割
- PSM_AUTO, ///< Fully automatic page segmentation, but no OSD. 完全自动分割
- PSM_SINGLE_COLUMN, ///< Assume a single column of text of variable sizes. 仅有一列大小变化的文本
- PSM_SINGLE_BLOCK_VERT_TEXT, ///< Assume a single uniform block of vertically aligned text. 假设一个统一的垂直对齐的文本块
- PSM_SINGLE_BLOCK, ///< Assume a single uniform block of text. (Default.) 假设一个统一的文本块
- PSM_SINGLE_LINE, ///< Treat the image as a single text line. 将图像视为一条单独的文本行
- PSM_SINGLE_WORD, ///< Treat the image as a single word. 单独的词
- PSM_CIRCLE_WORD, ///< Treat the image as a single word in a circle. 将图像看作一个圆圈中的单个单词
- PSM_SINGLE_CHAR, ///< Treat the image as a single character. 一个字符
- PSM_SPARSE_TEXT, ///< Find as much text as possible in no particular order. 找到尽可能多的文本,没有特别的顺序
- PSM_SPARSE_TEXT_OSD, ///< Sparse text with orientation and script det. 带定向和脚本依据的稀疏文本
- PSM_RAW_LINE, ///< Treat the image as a single text line, bypassing hacks that are Tesseract-specific. 将图像看作一个单独的文本行,绕过Tesseract-specific的检测
- PSM_COUNT ///< Number of enum entries. 枚举的条目数
page segmentation modes (psm命令)
- 0 Orientation and script detection (OSD) only 定位和脚本检测
- 1 Automatic page segmentation with OSD
- 2 Automatic page segmentation, but no OSD, or OCR
- 3 Fully automatic page segmentation, but no OSD. (Default)
- 4 Assume a single column of text of variable sizes
- 5 Assume a single uniform block of vertically aligned text
- 6 Assume a single uniform block of text
- 7 Treat the image as a single text line
- 8 Treat the image as a single word
- 9 Treat the image as a single word in a circle
- 10 Treat the image as a single character
- 11 Sparse text. Find as much text as possible in no particular order
- 12 Sparse text with OSD
- 13 Raw line. Treat the image as a single text line, bypassing hacks that are Tesseract-specific.
OcrEngineMode (OEM)
- OEM_TESSERACT_ONLY, // Run Tesseract only - fastest
- OEM_LSTM_ONLY, // Run just the LSTM line recognizer.
- OEM_TESSERACT_LSTM_COMBINED, // Run the LSTM recognizer, but allow fallback to Tesseract when things get difficult.
- OEM_DEFAULT, // Specify this mode when calling init_*(), to indicate that any of the above modes should be automatically inferred from the variables in the language-specific config, command-line configs, or if not specified in any of the above should be set to the default OEM_TESSERACT_ONLY.
- OEM_CUBE_ONLY, // Run Cube only - better accuracy, but slower
- OEM_TESSERACT_CUBE_COMBINED, // Run both and combine results - best accuracy
网友评论