freealise commited on
Commit
3d0dbc5
1 Parent(s): cd2fa70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -231,6 +231,7 @@ def rgb2gray(rgb):
231
  return np.dot(rgb[...,:3], [0.333, 0.333, 0.333])
232
 
233
  def get_mesh(image, depth, blur_data, loadall):
 
234
  global mesh
235
  if loadall == False:
236
  mesh = []
@@ -527,11 +528,11 @@ with gr.Blocks(css=css) as demo:
527
  evt.initEvent(\"click\", true, false);
528
  document.getElementById(\"reset_cam\").dispatchEvent(evt);
529
  }
530
- BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize = Math.ceil(Math.log2(Math.PI/this.value));
531
  BABYLON.Engine.LastCreatedScene.activeCamera.fov = this.value;
532
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
533
 
534
- document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
535
  '/><span>0.8</span>""")
536
  camera = gr.HTML(value="""<a href='#' id='reset_cam' onclick='
537
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
@@ -541,13 +542,13 @@ with gr.Blocks(css=css) as demo:
541
  }
542
  }
543
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
544
- BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize = Math.ceil(Math.log2(Math.PI/document.getElementById(\"zoom\").value));
545
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
546
  BABYLON.Engine.LastCreatedScene.activeCamera.fov = document.getElementById(\"zoom\").value;
547
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = document.getElementById(\"contrast\").value;
548
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = document.getElementById(\"exposure\").value;
549
 
550
- document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
551
  '>reset camera</a>""")
552
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='2.0' min='0' max='2' step='0.001' oninput='
553
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
@@ -615,10 +616,14 @@ with gr.Blocks(css=css) as demo:
615
  locations = json.loads(example_coords)
616
  for k, location in enumerate(locations):
617
  locations[k] = location["latLng"]
 
 
618
  else:
619
  locations = json.loads(coordinates)
620
  for k, location in enumerate(locations):
621
  locations[k] = location["location"]["latLng"]
 
 
622
  print(locations)
623
 
624
  # Process the video and get the path of the output video
 
231
  return np.dot(rgb[...,:3], [0.333, 0.333, 0.333])
232
 
233
  def get_mesh(image, depth, blur_data, loadall):
234
+ global locations
235
  global mesh
236
  if loadall == False:
237
  mesh = []
 
528
  evt.initEvent(\"click\", true, false);
529
  document.getElementById(\"reset_cam\").dispatchEvent(evt);
530
  }
531
+ BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize = Math.ceil(Math.log2(Math.PI/this.value));
532
  BABYLON.Engine.LastCreatedScene.activeCamera.fov = this.value;
533
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
534
 
535
+ document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
536
  '/><span>0.8</span>""")
537
  camera = gr.HTML(value="""<a href='#' id='reset_cam' onclick='
538
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
 
542
  }
543
  }
544
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
545
+ BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize = Math.ceil(Math.log2(Math.PI/document.getElementById(\"zoom\").value));
546
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
547
  BABYLON.Engine.LastCreatedScene.activeCamera.fov = document.getElementById(\"zoom\").value;
548
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = document.getElementById(\"contrast\").value;
549
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = document.getElementById(\"exposure\").value;
550
 
551
+ document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
552
  '>reset camera</a>""")
553
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='2.0' min='0' max='2' step='0.001' oninput='
554
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
 
616
  locations = json.loads(example_coords)
617
  for k, location in enumerate(locations):
618
  locations[k] = location["latLng"]
619
+ locations[k]["lat"] = locations[k]["lat"] - locations[0]["lat"]
620
+ locations[k]["lng"] = locations[k]["lng"] - locations[0]["lng"]
621
  else:
622
  locations = json.loads(coordinates)
623
  for k, location in enumerate(locations):
624
  locations[k] = location["location"]["latLng"]
625
+ locations[k]["lat"] = locations[k]["lat"] - locations[0]["lat"]
626
+ locations[k]["lng"] = locations[k]["lng"] - locations[0]["lng"]
627
  print(locations)
628
 
629
  # Process the video and get the path of the output video