freealise commited on
Commit
a886ac0
1 Parent(s): 2ebac0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
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["lng"]
244
  y = radius * np.cos(d_lat)
245
- z = radius * np.sin(d_lon) * np.sin(d_lat) + location["lat"]
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": -2.0593128411405814e-06, "lng": 7.138250595062345e-07, "heading": 152.70303, "pitch": 2.607833999999997},
734
- {"lat": 1.5397763348801163e-06, "lng": 1.3651150112536925e-06, "heading": 151.12973, "pitch": 2.8672300000000064},
735
- {"lat": -2.1552188087525792e-05, "lng": 1.5591533522041345e-05, "heading": 151.41025, "pitch": 3.4802200000000028},
736
- {"lat": -3.0588534016828817e-06, "lng": 3.549113042566887e-06, "heading": 151.93391, "pitch": 2.843050000000005},
737
- {"lat": 2.513057799546914e-05, "lng": -2.1219586638920873e-05, "heading": 152.95769, "pitch": 4.233024999999998}
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
- locations[k]["lat"] = measure(0, 0, (location["lat"] - avg[0]), 0) / 2.5 * 100
883
- locations[k]["lng"] = measure(0, 0, 0, (location["lng"] - avg[1])) / 2.5 * 100
 
 
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