Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ccmain/thresholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ std::tuple<bool, Image, Image, Image> ImageThresholder::Threshold(
tprintf("\nimage width: %d height: %d ppi: %d\n", pix_w, pix_h, yres_);
}

if (method == ThresholdMethod::Sauvola) {
if (method == ThresholdMethod::Sauvola && pix_w > 6 && pix_h > 6) {
// pixSauvolaBinarizeTiled requires half_window_size >= 2.
// Therefore window_size must be at least 4 which requires
// pix_w and pix_h to be at least 7.
int window_size;
double window_size_factor;
api->GetDoubleVariable("thresholding_window_size", &window_size_factor);
Expand Down
Loading