Currently, this is what you need to do for recognizing individual
lines:

import ocropy

# allocate objects
image = ocropy.bytearray()
fst = ocropy.make_OcroFST()
s = ocropy.ustrg()

# load the line recognizer
linerec = ocropy.load_linerec("some.model")
# load the image to be recognized
ocropy.read_image_gray(image,"some.jpg")
# perform the actual recognition and compute recognition alternatives
linerec.recognizeLine(fst,image)
# find the best solution
fst.bestpath(s)
# print the result
print ocropy.ustrg_as_string(s)

If you want to recognize blocks, you need to use one of the functions
that segments blocks into lines, then recognize the lines.  That looks
something like this:

# allocate data structures
pseg = ocropy.intarray()
segmenter = ocropy.make_ISegmentPage("SegmentPageByRAST1")
regions = ocropy.RegionExtractor()

# pseg is just a color image; regions is a little utility class that
iterates
# over differently colored regions in that color image
segmenter.segment(pseg,image)
regions.setPageLines(pseg)
for i in range(1,regions.length()):
    regions.extract(line,image,i,1)
    ... continue with line recognition ...

You can see all of this working in ocropy/ocropus-pages in 0.4.4

We'll try to add some convenience functions for all of this to the
library and document these use cases better.

Tom


On Mar 16, 12:59 pm, dataintelligence <[email protected]> wrote:
> Is it possible for me to hand ocropus a list of bounding boxes and get
> back the OCR results from those regions within an image?

-- 
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