Hi,
Hmm, I really need to check my code before I post a thread here...
Sorry for starting a topic; as it came out - I was passing the wrong
coordinates and the y0 and y1 variables had wrong values (y0 > y1).

The fact I have to supply those coordinates to the function is because
I'm working with a raster image and the coordinates system on it is
different than the one OCRopus uses...

May I ask one more question without starting a new thread?
I'm working on a function which accepts the coordinates for the bottom
left and upper right corner of a subimage of an image. It then should
do OCR on the subimage.
As I'm past the part with OCR (thanks again for your earlier help with
running the line recognizer and adding it to the wiki pages), I still
struggle how to return the text output from the OCR process...

I have something like this:
char* recognizeLine(int x0, int y0, int x1, int y1)
{
        ustrg text;
        utf8strg output;
        bytearray line, binline;
        double cost;
        int beam_width = 100;

        extract_subimage(line, clean, x0, y0, x1, y1);
        if(line.length()!=0)
        {
                        linerec->recognizeLine(*result, line);
                text.clear();
                cost = beam_search(text, *result, *langmodel, beam_width);
                if(cost>1e10) throw "beam search failed";
                text.utf8EncodeTerm(output);
                printf("%d = %s\n",output.length(),output.c_str());
                return (char*)output.c_str();
        }
        else
        {
                throw __FUNCTION__;
                return 0;
        }
}

For testing purposes I had to "borrow" a small part of the code from
OCRopus' source. The problem I have is with returning anything... The
printf() shows me correct results on stdout, but then, if I do return
(char*)output.c_str(); in the caller the initialised char* loses the
first 4 letters of the returned value... (it works fine when I use
valgrind ;-)).

I know it's a fairly simple question, but what would be the best way
of solving this problem? All the variables and components from OCRopus
are initialised correctly.

Thanks in advance for your help,
Regards,
Bill
--~--~---------~--~----~------------~-------~--~----~
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