Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -240,9 +240,9 @@ def pano_depth_to_world_points(depth, location):
|
|
240 |
d_lat = lat + j/2 * np.pi / depth.shape[0] + location["pitch"] / 180 * np.pi
|
241 |
|
242 |
# Convert to cartesian coordinates
|
243 |
-
x = radius * np.cos(d_lon) * np.sin(d_lat) + location["
|
244 |
y = radius * np.cos(d_lat)
|
245 |
-
z = radius * np.sin(d_lon) * np.sin(d_lat) + location["
|
246 |
|
247 |
pts = np.stack([x, y, z], axis=1)
|
248 |
uvs = np.stack([lon, lat], axis=1)
|
@@ -730,11 +730,11 @@ with gr.Blocks(css=css) as demo:
|
|
730 |
selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
|
731 |
output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
|
732 |
example_coords = """[
|
733 |
-
{"lat":
|
734 |
-
{"lat":
|
735 |
-
{"lat":
|
736 |
-
{"lat":
|
737 |
-
{"lat":
|
738 |
]"""
|
739 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
740 |
|
@@ -879,8 +879,10 @@ with gr.Blocks(css=css) as demo:
|
|
879 |
avg[0] = avg[0] / len(locations)
|
880 |
avg[1] = avg[1] / len(locations)
|
881 |
for k, location in enumerate(locations):
|
882 |
-
|
883 |
-
|
|
|
|
|
884 |
print(locations)
|
885 |
|
886 |
# Process the video and get the path of the output video
|
|
|
240 |
d_lat = lat + j/2 * np.pi / depth.shape[0] + location["pitch"] / 180 * np.pi
|
241 |
|
242 |
# Convert to cartesian coordinates
|
243 |
+
x = radius * np.cos(d_lon) * np.sin(d_lat) + location["lat"]
|
244 |
y = radius * np.cos(d_lat)
|
245 |
+
z = radius * np.sin(d_lon) * np.sin(d_lat) + location["lng"]
|
246 |
|
247 |
pts = np.stack([x, y, z], axis=1)
|
248 |
uvs = np.stack([lon, lat], axis=1)
|
|
|
730 |
selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
|
731 |
output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
|
732 |
example_coords = """[
|
733 |
+
{"lat": 50.07379596793083, "lng": 14.437146122950555, "heading": 152.70303, "pitch": 2.607833999999997},
|
734 |
+
{"lat": 50.073799567020004, "lng": 14.437146774240507, "heading": 151.12973, "pitch": 2.8672300000000064},
|
735 |
+
{"lat": 50.07377647505558, "lng": 14.437161000659017, "heading": 151.41025, "pitch": 3.4802200000000028},
|
736 |
+
{"lat": 50.07379496839027, "lng": 14.437148958238538, "heading": 151.93391, "pitch": 2.843050000000005},
|
737 |
+
{"lat": 50.073823157821664, "lng": 14.437124189538856, "heading": 152.95769, "pitch": 4.233024999999998}
|
738 |
]"""
|
739 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
740 |
|
|
|
879 |
avg[0] = avg[0] / len(locations)
|
880 |
avg[1] = avg[1] / len(locations)
|
881 |
for k, location in enumerate(locations):
|
882 |
+
lat = location["lat"] - avg[0]
|
883 |
+
lng = location["lng"] - avg[1]
|
884 |
+
locations[k]["lat"] = measure(0, 0, lat, 0) / 2.5 * 100 * np.sign(lat)
|
885 |
+
locations[k]["lng"] = measure(0, 0, 0, lng) / 2.5 * 100 * np.sign(lng)
|
886 |
print(locations)
|
887 |
|
888 |
# Process the video and get the path of the output video
|