Suppress Warning on Console when using Tess4j for OCRing

不打扰是莪最后的温柔 提交于 2019-12-11 07:25:57

问题


Help in Suppress Warning- "Warning. Invalid resolution 1 dpi. Using 70 instead." when using Tess4j for OCRing

Hi All, I would like to suppress the warning thrown out in Console when using Tess4j for OCRing. Please help.

Tesseract uses Leptonica for some image processing internally and Leptonica thows this on console.

TIA


回答1:


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);


来源:https://stackoverflow.com/questions/47268601/suppress-warning-on-console-when-using-tess4j-for-ocring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!