On Fri, Nov 9, 2012 at 1:43 PM, Troy Frazier <[email protected]> wrote:
> Is it possible to search an image for a particular word using the Tessnet
> wrapper? I see that it is possible to limit your scan to certain
> characters, but what I would like to do is to input a word and have all
> instances of that word be highlighted somehow. Can anyone point me in the
> right direction?
>
> Additional Info: I'm using Tessnet because it also comes in 64-bit, and
> that's what I need.
>
> I am not sure about Tessnet - AFAIK it was wrapping tesseract 2.0x...
It should be possible in tesseract 3.02 (there is C++ or C API) with
something like this (c++ code snippet):
...
const char *searchForWord = "name";
api->Recognize(0);
tesseract::ResultIterator* ri = api->GetIterator();
tesseract::PageIteratorLevel level = tesseract::RIL_WORD;
if (ri != 0) {
do {
const char* text = ri->GetUTF8Text(level);
if (strcmp(text, searchForWord) == 0) {
float conf = ri->Confidence(level);
int x1, y1, x2, y2;
ri->BoundingBox(level, &x1, &y1, &x2, &y2);
printf("text: '%s''; conf: %.2f; BoundingBox: %d,%d,%d,%d;\n",
text, conf, x1, y1, x2, y2);
}
delete[] text;
} while (ri->Next(level));
}
...
Instead of printf use your highlight routine (e.g. different
highlight color based on confidence value ;-) )...
--
Zdenko
--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" 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/tesseract-ocr?hl=en