【发布时间】: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:
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