def filter_and_bbox(imageIn): from gamera.toolkits.ocr.classes import Page my_filter(imageIn) #p = StepTwo(imageIn) p = Page(imageIn) p.segment() return show_lines(p)
def filter_and_bbox(imageIn): from gamera.toolkits.ocr.classes import Page my_filter(imageIn) #p = StepTwo(imageIn) p = Page(imageIn) p.segment() return show_lines(p)
median_cc = int(median([cc.nrows for cc in the_ccs])) autogroup = ClassifyCCs(cknn) autogroup.parts_to_group = 3 autogroup.grouping_distance = max([2,median_cc / 8]) p = Page(img, classify_ccs=autogroup) if opt.verbosity > 0: print "autogrouping glyphs activated." print "maximal autogroup distance:", autogroup.grouping_distance else: p = Page(img) if opt.verbosity > 0: print "start page segmentation..." t = time.time() p.segment() if opt.verbosity > 0: t = time.time() - t print "\t segmentation done [",t,"sec]" if opt.verbosity > 1: rgbfilename = "debug_lines.png" rgb = p.show_lines() rgb.save_PNG(rgbfilename) print "file '%s' written" % rgbfilename rgbfilename = "debug_chars.png" rgb = p.show_glyphs() rgb.save_PNG(rgbfilename) print "file '%s' written" % rgbfilename rgbfilename = "debug_words.png"
median_cc = int(median([cc.nrows for cc in the_ccs])) autogroup = ClassifyCCs(cknn) autogroup.parts_to_group = 3 autogroup.grouping_distance = max([2, median_cc / 8]) p = Page(img, classify_ccs=autogroup) if opt.verbosity > 0: print "autogrouping glyphs activated." print "maximal autogroup distance:", autogroup.grouping_distance else: p = Page(img) if opt.verbosity > 0: print "start page segmentation..." t = time.time() p.segment() if opt.verbosity > 0: t = time.time() - t print "\t segmentation done [", t, "sec]" if opt.verbosity > 1: rgbfilename = "debug_lines.png" rgb = p.show_lines() rgb.save_PNG(rgbfilename) print "file '%s' written" % rgbfilename rgbfilename = "debug_chars.png" rgb = p.show_glyphs() rgb.save_PNG(rgbfilename) print "file '%s' written" % rgbfilename rgbfilename = "debug_words.png"