问题描述
禁止使用警告-"警告.无效的分辨率1 dpi.改为使用70.".当使用Tess4j进行OCRing时
Help in Suppress Warning- "Warning. Invalid resolution 1 dpi. Using 70 instead." when using Tess4j for OCRing
大家好,我想抑制在使用Tess4j进行OCRing时在控制台中抛出的警告.请帮忙.
Hi All, I would like to suppress the warning thrown out in Console when using Tess4j for OCRing. Please help.
Tesseract在内部使用Leptonica进行某些图像处理,Leptonica在控制台上对此进行了介绍.
Tesseract uses Leptonica for some image processing internally and Leptonica thows this on console.
TIA
推荐答案
解决方法:并非来自Leptonica(lept4j),而是来自Tesseract(tess4j).如果图像的分辨率小于70,则设置分辨率".
A Workaround: Not from Leptonica(lept4j) but from Tesseract(tess4j) way. Setting the Resolution if the resolution of the image if it is less than 70.
TessAPI1.TessBaseAPISetImage2(handle, pix);
//To remove the warning message "Warning. Invalid resolution 1 dpi. Using 70 instead." Setting the resolution
int res = TessAPI1.TessBaseAPIGetSourceYResolution(handle);
if (res < 70)
TessAPI1.TessBaseAPISetSourceResolution(handle, 70);
这篇关于使用Tess4j进行OCRing时禁止在控制台上显示警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!