diff --git a/api/baseapi.cpp b/api/baseapi.cpp index b24742435f..d9bc1f9d9a 100644 --- a/api/baseapi.cpp +++ b/api/baseapi.cpp @@ -2223,6 +2223,8 @@ void TessBaseAPI::Threshold(Pix** pix) { if (y_res < kMinCredibleResolution || y_res > kMaxCredibleResolution) { // Use the minimum default resolution, as it is safer to under-estimate // than over-estimate resolution. + tprintf("Warning. Invalid resolution %d dpi. Using %d instead.\n", + y_res, kMinCredibleResolution); thresholder_->SetSourceYResolution(kMinCredibleResolution); } PageSegMode pageseg_mode = diff --git a/ccmain/osdetect.cpp b/ccmain/osdetect.cpp index f2fe94a1c3..69e626222f 100644 --- a/ccmain/osdetect.cpp +++ b/ccmain/osdetect.cpp @@ -164,8 +164,14 @@ void remove_nontext_regions(tesseract::Tesseract *tess, BLOCK_LIST *blocks, int vertical_y = 1; tesseract::TabVector_LIST v_lines; tesseract::TabVector_LIST h_lines; - int resolution = (kMinCredibleResolution > pixGetXRes(pix)) ? - kMinCredibleResolution : pixGetXRes(pix); + int resolution; + if (kMinCredibleResolution > pixGetXRes(pix)) { + resolution = kMinCredibleResolution; + tprintf("Warning. Invalid resolution %d dpi. Using %d instead.\n", + pixGetXRes(pix), resolution); + } else { + resolution = pixGetXRes(pix); + } tesseract::LineFinder::FindAndRemoveLines(resolution, false, pix, &vertical_x, &vertical_y,