Ejemplo n.º 1
0
def run(img):
    extracted = extract_paper(img)
    graph = sketch_graph(extracted)
    graph = hv_lines(graph, extracted)
    
    svg = printer.graph_to_svg(graph)
    printer.write_file("log/out.svg", svg)
    pdf = printer.svg_to_pdf("log/out.svg", "log/out.pdf")
    printer.write_file("log/out.pdf", pdf)
Ejemplo n.º 2
0
def run(img):
    extracted = extract_paper(img)
    graph = sketch_graph(extracted)
    graph = hv_lines(graph, extracted)

    svg = printer.graph_to_svg(graph)
    printer.write_file("log/out.svg", svg)
    pdf = printer.svg_to_pdf("log/out.svg", "log/out.pdf")
    printer.write_file("log/out.pdf", pdf)
Ejemplo n.º 3
0
def run(img):
    img = extract_paper(img)

    graph = sketch_graph(img)

    components = nx.connected_components(graph)

    circles = [
        topology.fit_circle_to_points(list(component))
        for component in components
    ]

    log.hsvOrGreyImage(img, circles=circles)

    svg = printer.circles_to_svg(circles)
    printer.write_file("log/out.svg", svg)
    pdf = printer.svg_to_pdf("log/out.svg", "log/out.pdf")
    printer.write_file("log/out.pdf", pdf)
    # printer.print_pdf("log/out.pdf")

    return graph