Spaces:
Runtime error
Runtime error
File size: 935 Bytes
1cbfd2b 626bf47 1cbfd2b 626bf47 1cbfd2b 626bf47 1cbfd2b 171b3cf 1cbfd2b 626bf47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import gradio as gr
import kornia as K
from skimage import io
from kornia.contrib import ImageStitcher
import kornia.feature as KF
def enhance(file_1, file_2):
img_1 = K.image_to_tensor(io.imread(file_1), False).float() / 255.
img_2 = K.image_to_tensor(io.imread(file_2), False).float() / 255.
IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac')
result = IS(img_1, img_2)
return K.tensor_to_image(result[0])
examples = [
['examples/foto1B.jpg'],
['examples/foto1A.jpg'],
]
inputs = [
gr.inputs.Image(type='file', label='Input Image'),
gr.inputs.Image(type='file', label='Input Image'),
]
outputs = [
gr.outputs.Image(type='file', label='Output Image'),
]
title = "Image Stitching using Kornia and LoFTR"
demo_app = gr.Interface(
fn=enhance,
inputs=inputs,
outputs=outputs,
title=title,
examples=examples,
live=True,
)
demo_app.launch()
|