diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index 0acf2dc9..a65ec523 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -2107,15 +2107,12 @@ bool TessBaseAPI::Threshold(Pix **pix) { } thresholder_->SetSourceYResolution(kMinCredibleResolution); } - auto pageseg_mode = static_cast(static_cast(tesseract_->tessedit_pageseg_mode)); - - Image pix_binary(*pix); - Image pix_grey; - Image pix_thresholds; auto thresholding_method = static_cast(static_cast(tesseract_->thresholding_method)); if (thresholding_method == ThresholdMethod::Otsu) { + auto pageseg_mode = static_cast(static_cast(tesseract_->tessedit_pageseg_mode)); + Image pix_binary(*pix); if (!thresholder_->ThresholdToPix(pageseg_mode, &pix_binary)) { return false; }