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(names.at(i), values.at(i), 
tesseract::SET_PARAM_CONSTRAINT_NONE, &p);
  }

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 tesseract-ocr+unsubscr...@googlegroups.com.
To post to this group, send email to tesseract-ocr@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/57c390dc-4e9d-48cd-8779-263c5169ea0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to