Skip to content

Commit

Permalink
Change default resolution from 70 to 300 dpi
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stweil committed Aug 8, 2017
1 parent 5f5e85e commit 0720b3f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ const int kMaxIntSize = 22;
const int kMinCredibleResolution = 70;
/** Maximum believable resolution. */
const int kMaxCredibleResolution = 2400;
/** Default resolution. */
const int kDefaultResolution = 300;

TessBaseAPI::TessBaseAPI()
: tesseract_(nullptr),
Expand Down Expand Up @@ -2199,8 +2201,8 @@ bool TessBaseAPI::Threshold(Pix** pix) {
// 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);
kDefaultResolution);
thresholder_->SetSourceYResolution(kDefaultResolution);
}
PageSegMode pageseg_mode =
static_cast<PageSegMode>(
Expand Down

0 comments on commit 0720b3f

Please sign in to comment.