【问题标题】:Differences between Google Street View API pano parameters (Javascript vs HTTP)Google Street View API 全景参数之间的差异(Javascript 与 HTTP)
【发布时间】:2017-11-07 14:04:01
【问题描述】:

我正在做一个计算机视觉项目,我做了一个 javascript 程序(使用 JS Google Street View API)来注释 Google 街景图像中的对象。

我的问题如下:

当我使用Google Street View HTTP API 检索我用我的javascript 程序注释的图像时,即使我使用相同的确切参数来获取街景,返回的图像也不完全相同。

举个例子总比长篇大论好,有谁知道为什么 2 个不同的 API 会针对相同的参数给出不同的图像?

(panoId="cBMoF9_AqIlK81fFNelY3g",
标题=258.7435095128366,
间距=-3.895758339008495,
尺寸=600x600 例如)

我收到this image with the HTTP Google Street View API

this other one with the JS Google Street View API

我一开始以为是因为 zoom/fov 属性的不同,但正如this post 确认的那样,zoom=3 相当于 fov=22.5 (参见我的示例)。此外,我使用默认值 (zoom=1 / fov=90) 进行测试,图像也不完全相同。

关于更多细节,我在下面的 sn-p 中复制了我的一部分 javascript 代码,可以与 HTTP API 链接进行比较。 (不要忘记更改 YOUR_API_KEY !!!)

HTTP API:

https://maps.googleapis.com/maps/api/streetview?size=600x600&pano=cBMoF9_AqIlK81fFNelY3g&heading=259.61209261440393&pitch=-2.9417641281063715&fov=22.5

Javacript API:

function initialize() {

  // Set up the map.
  map = new google.maps.Map(document.getElementById('map'), {
    center: {"lat": 48.84981719, "lng": 2.29300828},
    zoom: 16
  });

  var marker = new google.maps.Marker({
    position: {"lat": 48.84981719, "lng": 2.29300828},
    map: map,
    title: "test",
    draggable: true
  });

  var panorama = new google.maps.StreetViewPanorama(
    document.getElementById('pano'), {
      // position: params.center,
      pano: "cBMoF9_AqIlK81fFNelY3g",
      pov: {
        heading: 258.7435095128366,
        pitch: -3.895758339008495
      },
      zoom: 3,
      mode: "html5"
    });
  map.setStreetView(panorama);

}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

#map, #pano {
  float: left;
  height: 600px;
  width: 600px;
  position: relative;
  z-index: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="map"></div>
<div id="pano"></div>
<script async defer type="text/javascript">
  var apiKey = "YOUR_API_KEY";
  var googleURL = 'https://maps.googleapis.com/maps/api/js?key=' + apiKey + "&callback=initialize";
  $.getScript(googleURL)
</script>

【问题讨论】:

    标签: javascript google-maps-api-3 google-street-view


    【解决方案1】:

    我遇到了相关问题,我得出的结论是街景元数据 API 给出的坐标不正确(随机扰动?)。

    比如有一对相邻的全景图如下。

    元数据 API 将坐标 [lat,lon] 提供为:[ 14.43644554, 99.87141436], [ 14.4365385, 99.8714599 ]。计算位移:东4.904米,北10.337米。计算间隔:11.441 米。计算航向 25.38 度。

    在浏览器 (HTTP API) 中,它们显示为:[ 14.4364125, 99.8713909], [ 14.4364907, 99.8714431]。计算位移:东 5.621 米,北 8.695 米。计算间隔:10.354 米。计算出的航向 32.88 度。

    差别真的很大!

    (在此示例中,如果将来自 Metadata API 的坐标提供给 HTTP API,则 HTTP API 呈现与 Python 图像 API 相同的全景图,但我也看到过类似 OP 给出的示例,其中不同的全景图被返回。)

    我真的很想听听任何能对此有所了解的人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多