fix description
Browse files
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
from math import ceil, floor, pi
|
| 2 |
from pathlib import Path
|
|
|
|
|
|
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
import matplotlib
|
|
@@ -22,6 +24,35 @@ MODEL_DIR = Path("/models") # mounted from https://huggingface.co/javrtg/AnyCal
|
|
| 22 |
ASSETS_DIR = Path(__file__).resolve().parent / "assets"
|
| 23 |
gr.set_static_paths(paths=[ASSETS_DIR])
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
def get_model(model_id: str) -> AnyCalib:
|
| 27 |
model = AnyCalib(model_id=None)
|
|
@@ -179,28 +210,6 @@ def run_demo(
|
|
| 179 |
|
| 180 |
|
| 181 |
def build_demo() -> gr.Blocks:
|
| 182 |
-
description = """
|
| 183 |
-
<div align="center">
|
| 184 |
-
<h1>
|
| 185 |
-
AnyCalib:<br>
|
| 186 |
-
On-Manifold Learning for Model-Agnostic Single-View Camera Calibration
|
| 187 |
-
</h1>
|
| 188 |
-
<h3>
|
| 189 |
-
<a href="https://javrtg.github.io/">Javier Tirado-Garín</a>
|
| 190 |
-
  
|
| 191 |
-
<a href="https://scholar.google.com/citations?user=j_sMzokAAAAJ">Javier Civera</a><br>
|
| 192 |
-
I3A, University of Zaragoza
|
| 193 |
-
</h3>
|
| 194 |
-
<img width="60%" src="/gradio_api/file=assets/method_dark.png">
|
| 195 |
-
<h3>
|
| 196 |
-
Camera calibration from a single perspective/edited/distorted image using a freely chosen camera model<br>
|
| 197 |
-
<a href="https://github.com/javrtg/AnyCalib">Code</a>
|
| 198 |
-
 
|
| 199 |
-
<a href="https://arxiv.org/abs/2503.12701">Paper</a>
|
| 200 |
-
</h3>
|
| 201 |
-
</div>
|
| 202 |
-
"""
|
| 203 |
-
|
| 204 |
def update_distortion_range(camera_model):
|
| 205 |
min_dist, max_dist, default_dist = CAM_DISTCOEFFS[camera_model]
|
| 206 |
num_dist_params = gr.Number(
|
|
|
|
| 1 |
from math import ceil, floor, pi
|
| 2 |
from pathlib import Path
|
| 3 |
+
from textwrap import dedent
|
| 4 |
+
from urllib.parse import quote
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
import matplotlib
|
|
|
|
| 24 |
ASSETS_DIR = Path(__file__).resolve().parent / "assets"
|
| 25 |
gr.set_static_paths(paths=[ASSETS_DIR])
|
| 26 |
|
| 27 |
+
method_img = (
|
| 28 |
+
f"/gradio_api/file={quote(str((ASSETS_DIR / 'method_dark.png').resolve()))}"
|
| 29 |
+
)
|
| 30 |
+
description = dedent(f"""
|
| 31 |
+
<div style="text-align: center;">
|
| 32 |
+
<h1>
|
| 33 |
+
AnyCalib:<br>
|
| 34 |
+
On-Manifold Learning for Model-Agnostic Single-View Camera Calibration
|
| 35 |
+
</h1>
|
| 36 |
+
<h3>
|
| 37 |
+
<a href="https://javrtg.github.io/">Javier Tirado-Garín</a>
|
| 38 |
+
  
|
| 39 |
+
<a href="https://scholar.google.com/citations?user=j_sMzokAAAAJ">Javier Civera</a><br>
|
| 40 |
+
I3A, University of Zaragoza
|
| 41 |
+
</h3>
|
| 42 |
+
<img
|
| 43 |
+
src="{method_img}"
|
| 44 |
+
style="display: block; width: 60%; max-width: 900px; margin: 1rem auto;"
|
| 45 |
+
alt="AnyCalib method overview"
|
| 46 |
+
>
|
| 47 |
+
<h3>
|
| 48 |
+
Camera calibration from a single perspective/edited/distorted image using a freely chosen camera model<br>
|
| 49 |
+
<a href="https://github.com/javrtg/AnyCalib">Code</a>
|
| 50 |
+
 
|
| 51 |
+
<a href="https://arxiv.org/abs/2503.12701">Paper</a>
|
| 52 |
+
</h3>
|
| 53 |
+
</div>
|
| 54 |
+
""")
|
| 55 |
+
|
| 56 |
|
| 57 |
def get_model(model_id: str) -> AnyCalib:
|
| 58 |
model = AnyCalib(model_id=None)
|
|
|
|
| 210 |
|
| 211 |
|
| 212 |
def build_demo() -> gr.Blocks:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
def update_distortion_range(camera_model):
|
| 214 |
min_dist, max_dist, default_dist = CAM_DISTCOEFFS[camera_model]
|
| 215 |
num_dist_params = gr.Number(
|