def segment(img): """ img should be filename """ raw_boxes = get_bounding_boxes(img) clusters = cluster(raw_boxes) total = [] index = 0 total,index = crop(img,[c.bounding_box() for c in clusters],index) result = {'arith': total, 'mat': []} return result
def segment(img): """ img should be filename """ raw_boxes = get_bounding_boxes(img) clusters = matrix_cluster(raw_boxes) total = [] index = 0 for row in clusters: images,index = crop(img,[c.bounding_box() for c in row],index) total.append(images) result = {'arith': total, 'mat': []} return result