Ejemplo n.º 1
0
def example(app: App):
    make_sepia_5()
    make_sepia_10()
    make_sepia_20()
    make_sepia_30()
    make_sepia_40()
    make_sepia_50()
    make_sepia_60()

    data = {
        'title':
        'Sepia algorithm',
        'header':
        'Sepia algorithm with following factors: 5, 10, 20, 30, 40, 50, 60',
        'image_data': [
            ImageData("Factor: 5", "desert_sepia_5.jpg"),
            ImageData("Factor: 10", "desert_sepia_10.jpg"),
            ImageData("Factor: 20", "desert_sepia_20.jpg"),
            ImageData("Factor: 30", "desert_sepia_30.jpg"),
            ImageData("Factor: 40", "desert_sepia_40.jpg"),
            ImageData("Factor: 50", "desert_sepia_50.jpg"),
            ImageData("Factor: 60", "desert_sepia_60.jpg"),
        ]
    }
    app.register_route("/", template_name="main_page.html", **data)
Ejemplo n.º 2
0
def main():
    args = parse_args()
    app = App()
    if args.example:
        example(app)
        app.run_server('127.0.0.1', 8000, open_webiste=args.visualize)
    else:
        apply_convolution(args.src, args.dest, filter_kernel)
Ejemplo n.º 3
0
def main():
    args = parse_args()
    app = App()
    if args.example:
        example(app)
        app.run_server('127.0.0.1', 8000, open_webiste=args.visualize)
    else:
        make_sepia(args.src, args.dest, args.factor)
Ejemplo n.º 4
0
def example_bicubic(app: App):
    bicubic_2()
    bicubic_4()

    data = {
        'title': 'Resizing',
        'header': 'Bicubic interpolation',
        'image_data': [ImageData("Scale: 2", "bc_2.jpg"), ImageData("Scale: 4", "bc_4.jpg")]
    }
    app.register_route("/bicubic_interpolation", template_name="main_page.html", **data)
Ejemplo n.º 5
0
def example_nearest_neighbour(app: App):
    neigbhour_2()
    neigbhour_4()

    data = {
        'title': 'Resizing',
        'header': 'Nearest neighbour interpolation',
        'image_data': [ImageData("Scale: 2", "n_2.jpg"), ImageData("Scale: 4", "n_4.jpg")]
    }
    app.register_route("/nearest_neighbour/", template_name="main_page.html", **data)
Ejemplo n.º 6
0
def example(app: App):
    apply_convolution('tests/data/flower.jpg', 'data/flower_convoluted.jpg',
                      filter_kernel)
    data = {
        'title': 'Convolution algorithm',
        'header': ' ',
        'image_data': [
            ImageData("Convoluted image", "flower_convoluted.jpg"),
        ]
    }
    app.register_route("/", template_name="main_page.html", **data)
Ejemplo n.º 7
0
    parser.add_argument("--dest",
                        type=str,
                        help="Destination file path.",
                        default='data/')
    parser.add_argument("--factor", type=int, help="Sepia factor value")
    parser.add_argument("--example",
                        type=bool,
                        help="Show example",
                        default=False)
    parser.add_argument("--visualize",
                        type=bool,
                        help="Open visualization in webbrowser",
                        default=False)
    return parser.parse_args()


def main():
    args = parse_args()
    app = App()
    if args.example:
        example(app)
        app.run_server('127.0.0.1', 8000, open_webiste=args.visualize)
    else:
        apply_convolution(args.src, args.dest, filter_kernel)


if __name__ == "__main__":
    app = App()
    example(app)
    app.run_server("127.0.0.1", 8001, open_webiste=True)