mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 11:09:06 +08:00
Optimize code for binarization
Some code is only needed for Otsu or even not at all. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
4b5dd25b84
commit
bf84fb9f2d
@ -2107,15 +2107,12 @@ bool TessBaseAPI::Threshold(Pix **pix) {
|
||||
}
|
||||
thresholder_->SetSourceYResolution(kMinCredibleResolution);
|
||||
}
|
||||
auto pageseg_mode = static_cast<PageSegMode>(static_cast<int>(tesseract_->tessedit_pageseg_mode));
|
||||
|
||||
Image pix_binary(*pix);
|
||||
Image pix_grey;
|
||||
Image pix_thresholds;
|
||||
|
||||
auto thresholding_method = static_cast<ThresholdMethod>(static_cast<int>(tesseract_->thresholding_method));
|
||||
|
||||
if (thresholding_method == ThresholdMethod::Otsu) {
|
||||
auto pageseg_mode = static_cast<PageSegMode>(static_cast<int>(tesseract_->tessedit_pageseg_mode));
|
||||
Image pix_binary(*pix);
|
||||
if (!thresholder_->ThresholdToPix(pageseg_mode, &pix_binary)) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user