Repository: tesseract-ocr/tesseract
File: src/ccmain/tesseractclass.cpp (C++)

Code before:
#include "tesseractclass.h"

#include <allheaders.h>
#include "edgblob.h"
#ifndef DISABLED_LEGACY_ENGINE
#  include "equationdetect.h"
#endif
#include "lstmrecognizer.h"
#include "thresholder.h" // for ThresholdMethod

namespace tesseract {

Tesseract::Tesseract()
    : BOOL_MEMBER(tessedit_resegment_from_boxes, false,
                  "Take segmentation and labeling from box file", this->params())
    , BOOL_MEMBER(tessedit_resegment_from_line_boxes, false,
                  "Conversion of word/line box file to char box file", this->params())
    , BOOL_MEMBER(tessedit_train_from_boxes, false, "Generate training data from boxed chars",
                  this->params())
    , BOOL_MEMBER(tessedit_make_boxes_from_boxes, false, "Generate more boxes from boxed chars",
                  this->params())
    , BOOL_MEMBER(tessedit_train_line_recognizer, false,
                  "Break input into lines and remap boxes if present", this->params())
    , BOOL_MEMBER(tessedit_dump_pageseg_images, false,
                  "Dump intermediate images made during page segmentation", this->params())
    , BOOL_MEMBER(tessedit_do_invert, true, "Try inverting the image in `LSTMRecognizeWord`",
                  this->params())
    ,
    // The default for pageseg_mode is the old behaviour, so as not to
    // upset anything that relies on that.
    INT_MEMBER(tessedit_pageseg_mode, PSM_SINGLE_BLOCK,
               "Page seg mode: 0=osd only, 1=auto+osd, 2=auto_only, 3=auto, "
               "4=column,"
               " 5=block_vert, 6=block, 7=line, 8=word, 9=word_circle, 10=char,"
               "11=sparse_text, 12=sparse_text+osd, 13=raw_line"
               " (Values from PageSegMode enum in tesseract/publictypes.h)",
               this->params())
    , INT_MEMBER(thresholding_method,
                 static_cast<int>(ThresholdMethod::Otsu),
                 "Thresholding method: 0 = Otsu, 1 = LeptonicaOtsu, 2 = "
                 "Sauvola",
                 this->params())
    , BOOL_MEMBER(thresholding_debug, false,
                  "Debug the thresholding process",
                  this->params())
    , double_MEMBER(thresholding_window_size, 0.33,
                    "Window size for measuring local statistics (to be "
                    "multiplied by image DPI). "
                    "This parameter is used by the Sauvola thresholding method",
                    this->params())
    , double_MEMBER(thresholding_kfactor, 0.34,

Review comment (suggestion):
What about adding to the parameter description: 

`This parameter is deprecated and will be removed in version 6.0. Use the 'invert_threshold' parameter instead.`

Also add:

`// DEPRECATED`

or
```
// TODO (Stefan)
// Remove 'do_invert' in 6.0.
```
comment above.


This parameter deprecation should be mentioned in the release notes.


Code after:
#include "tesseractclass.h"

#include <allheaders.h>
#include "edgblob.h"
#ifndef DISABLED_LEGACY_ENGINE
#  include "equationdetect.h"
#endif
#include "lstmrecognizer.h"
#include "thresholder.h" // for ThresholdMethod

namespace tesseract {

Tesseract::Tesseract()
    : BOOL_MEMBER(tessedit_resegment_from_boxes, false,
                  "Take segmentation and labeling from box file", this->params())
    , BOOL_MEMBER(tessedit_resegment_from_line_boxes, false,
                  "Conversion of word/line box file to char box file", this->params())
    , BOOL_MEMBER(tessedit_train_from_boxes, false, "Generate training data from boxed chars",
                  this->params())
    , BOOL_MEMBER(tessedit_make_boxes_from_boxes, false, "Generate more boxes from boxed chars",
                  this->params())
    , BOOL_MEMBER(tessedit_train_line_recognizer, false,
                  "Break input into lines and remap boxes if present", this->params())
    , BOOL_MEMBER(tessedit_dump_pageseg_images, false,
                  "Dump intermediate images made during page segmentation", this->params())
    , BOOL_MEMBER(tessedit_do_invert, true, "Try inverted line image if necessary",
                  this->params())
    , double_MEMBER(invert_threshold, 0.7,
                    "For lines with a mean confidence below this value, OCR is also tried with an inverted image",
                    this->params())
    ,
    // The default for pageseg_mode is the old behaviour, so as not to
    // upset anything that relies on that.
    INT_MEMBER(tessedit_pageseg_mode, PSM_SINGLE_BLOCK,
               "Page seg mode: 0=osd only, 1=auto+osd, 2=auto_only, 3=auto, "
               "4=column,"
               " 5=block_vert, 6=block, 7=line, 8=word, 9=word_circle, 10=char,"
               "11=sparse_text, 12=sparse_text+osd, 13=raw_line"
               " (Values from PageSegMode enum in tesseract/publictypes.h)",
               this->params())
    , INT_MEMBER(thresholding_method,
                 static_cast<int>(ThresholdMethod::Otsu),
                 "Thresholding method: 0 = Otsu, 1 = LeptonicaOtsu, 2 = "
                 "Sauvola",
                 this->params())
    , BOOL_MEMBER(thresholding_debug, false,
                  "Debug the thresholding process",
                  this->params())
    , double_MEMBER(thresholding_window_size, 0.33,
                    "Window size for measuring local statistics (to be "
                    "multiplied by image DPI). "