next up previous contents index
Next: GUI wrapper - message Up: Frontend API Previous: A simple example   Contents   Index

Serious tweaking

This is under serious review

Although libgocr has several module types, you don't have to use them all, and is free to abuse of the architecture. In fact, only doing so you'll be able to take full advantage of libgocr's power.

Let's say, for example, that you are writing an algorithm that skips the segmentation process, finding characters directly. At first, it seems that such algorithm would be completely incompatible with libgocr's structure; but it's not. Here are some possible solutions:

You may think that this is an ugly hack, but it's not. I'll explain why: since the architecture of libgocr is modular, and the modules can be used independently (with certain exceptions), it's not only OK to do it, it's designed to be used this way. The module types had to be given names, but it's as wrong to think that a charFinder module should only frame characters as to think that charRecognizer can only recognize usual characters, and not musical notes.

Something else: do not get stuck with gocr_runAllModules(). Since you may change interpretation of module types, it may be interesting to run them in a different way, skip some, run some twice, allow feedback, etc.

The question that arises now is: why not make the modules objetcs, similarly to what is done with block types (see 3.4.1)?

If you need to create a new module type, it's likely to be a very specific situation, where you do not care about compatibility.


next up previous contents index
Next: GUI wrapper - message Up: Frontend API Previous: A simple example   Contents   Index
root 2002-02-17