问题
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