For the R bindings for Tesseract, we would like the user to be able to set 
custom tesseract parameters to api->Init() at runtime. However due to the 
way tesseract is implemented, tesseract crashes the R process if the user 
passes an unsupported parameter (see GH issue #1334). This is very bad.

As a workaround, I would like to first validate each user parameter before 
passing them to api->Init(). Currently my code looks like below, where 
'names' and 'values' are string vectors, and 'out' is a boolean vector:

  tesseract::ParamsVectors p;
  for(size_t i = 0; i < names.size(); i++){
    out[i] = tesseract::ParamUtils::SetParam(,, 

This code works, however it actually returns FALSE for some parameters. To 
be precise, from the 680 parameters returned by api->PrintVariables() in 
Tesseract 3.05, only the first 222 (until classify_pico_feature_length) are 
marked as valid this way.

I don't understand why this happens. Maybe some parameters are init-only 
and others are not? What would be a method to validate a tesseract 
parameter in C++ that would return TRUE for any supported tesseract 
parameter? Such that we can be sure that it is safe to pass these 
parameters to base->Init() ?

You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to