There's a bug in the x0/y0/x1/y1 methods (I'll push a fix later).
Just use
y0,y1,x0,x1 = regions.bbox(num)
instead.
Tom
On Wednesday, April 10, 2013 3:09:16 PM UTC+2, Rémi Caruyer wrote:
>
> Hello,
>
> I want to retrieve the values x0, y0, width and height for each row. How
> can I retrieve these values (file-ocropus gpageseg)?
>
> I tried this:
>
> In ocropus-gpageseg :
>
> for i,l in enumerate(lines):
> binline = psegutils.extract_masked(1-cleaned,l,pad=args.pad,expand
> =args.expand)
> ocrolib.write_image_binary("%s_ligne%04d.png"%(outputdir,i+1),
> binline)
> chaine = ocrolib.write_coord(segmentation,i+1)
> fichier = open("%s_ligne%04d.txt"%(outputdir,i+1), 'w')
> fichier.write(chaine)
> fichier.close()
>
> And in common.py :
>
> def write_coord(pseg,num):
> regions = ocrolib.RegionExtractor()
> regions.setPageLines(pseg)
> x0,y0,x1,y1 = (regions.x0(num),regions.y0(num),regions.x1(num),regions
> .y1(num))
> height = y1 - y0
> width = x1 - x0
> chaine = str(x0) + " " + str(width) + " " + str(y0) + " " + str(height
> )
> #chaine = "12 24 15 26"
> return chaine
>
>
> But I have an error : AttributeError: RegionExtractor instance has no
> attribute 'comp'
>
>
> How can I retrieve this coordinates?
>
> Thank you.
>
--
You received this message because you are subscribed to the Google Groups
"ocropus" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msg/ocropus/-/v2jdqucRBCEJ.
For more options, visit https://groups.google.com/groups/opt_out.