Skip to content

Commit 0720b3f

Browse files
committed
Change default resolution from 70 to 300 dpi
The default resolution is used for images without an explicit resolution or with an unreasonable resolution (smaller than 70 or larger than 2400). Signed-off-by: Stefan Weil <[email protected]>
1 parent 5f5e85e commit 0720b3f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

api/baseapi.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ const int kMaxIntSize = 22;
106106
const int kMinCredibleResolution = 70;
107107
/** Maximum believable resolution. */
108108
const int kMaxCredibleResolution = 2400;
109+
/** Default resolution. */
110+
const int kDefaultResolution = 300;
109111

110112
TessBaseAPI::TessBaseAPI()
111113
: tesseract_(nullptr),
@@ -2199,8 +2201,8 @@ bool TessBaseAPI::Threshold(Pix** pix) {
21992201
// Use the minimum default resolution, as it is safer to under-estimate
22002202
// than over-estimate resolution.
22012203
tprintf("Warning. Invalid resolution %d dpi. Using %d instead.\n", y_res,
2202-
kMinCredibleResolution);
2203-
thresholder_->SetSourceYResolution(kMinCredibleResolution);
2204+
kDefaultResolution);
2205+
thresholder_->SetSourceYResolution(kDefaultResolution);
22042206
}
22052207
PageSegMode pageseg_mode =
22062208
static_cast<PageSegMode>(

0 commit comments

Comments
 (0)