> autodel<glinerec::IModel> classifier;
> FILE * modelFile = fopen("/usr/local/share/ocropus/models/
> default.model","rb");
> classifier =
> dynamic_cast<glinerec::IModel*>(load_component(modelFile));
>
> but it always returns a null pointer. Am I missing something? Which is
> the best way to instantiate a single character classifier and classify
> a character candidate?

The default models are line models, not character models.  In line
models, the character recognizer is trained with not just the image of
the character itself, but also context.  That's because in Latin
script, many characters are context dependent (mostly size and
position: c/C, p/P, etc.).

If you run

$ ocropus cinfo /usr/local/share/ocropus/models/default.model
Linerec
linerec_verbose=0
linerec_grouper=SimpleGrouper
linerec_use_reject=1
linerec_use_priors=0
...
$

it tells you that the model file is a Linerec, not an IModel.  (Sorry
about the confusing use of the term "model"; it's used for both
character and line models.)

The new Python-based recognizer can train and recognize character
models.  Those character models end in .cmodel.  There is a couple of
them in the latest version of OCRopus: /usr/local/share/ocropus/models/
2m2-reject.cmodel and /usr/local/share/ocropus/models/multi3.cmodel

> Thanks for your answer. I managed to get the bounding boxes with an
> IGrouper in the following way:
>
> autodel<IGrouper> grouper(make_StandardGrouper());
> grouper->setSegmentation(segmented);
> for (int k = 0; k < grouper->length(); ++k) {
>         rectangle r = grouper->boundingBox(k);
>
> }
>
> I know that it doesn't give the unique candidates, but it tries to
> group them in order to find some real character. Now I would like to
> call a character classifier to find a classification to use with
> grouper->setClass() function. I tried in the following way:

Well, you can look at the code for Linerec in C++ to see how this
works from C++.

There is a fairly complete and commented Python version of a simple
line recognizers in ocropy/ocropy:

http://code.google.com/p/ocropus/source/browse/ocropy/simplerec.py?repo=ocropy

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"ocropus" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/ocropus?hl=en.

Reply via email to