本文介绍了谷歌街景:FOV和缩放之间的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我可以使用Google Maps Android API进行转换的公式:



这是从Google Streetview Image API下载的图像,视频76.8(

这是从Google Streetview Image API下载的FOV 45图片(

我得到的最接近的是如果我制作了FOV 26,但这是我猜测,不使用公式 - 下面的图像是在FOV 26:



解决方案



我终于不得不倒退线以获得指数公式。 >我使用了这个网站,并且手动输入了可以很好地协同工作的FOV和缩放值的数据点组合:



我的数据点是:



FOV(在FOV旁边的括号内放大)

(b)
$ b $ (b)50(1)

45(1.2)

37(1.5)



26(2)

69(0.5)

78 (0.3)

31(1.9)

为了获得更接近的公式,您可以连续添加更多的很好的数据点,但我没有时间 - 任何想要完善公式的人都可以尝试。



我得到下面的公式其中Y是FOV,X是缩放。

Y = 103.7587(0.5051 ^ X)

相关= -0.9882

Does anyone know of a formula that I can use to convert from Zoom in Google Maps Android API: https://developers.google.com/maps/documentation/android-api/streetview to the FOV used in the Google StreetView Image API: https://developers.google.com/maps/documentation/streetview/intro?

I found a couple of old formulas here:

  1. https://groups.google.com/forum/#!topic/google-maps-js-api-v3/uqKfg0ZBhWc
  2. https://groups.google.com/forum/#!msg/google-maps-image-apis/O_Odb0A7_0c/Q74cHCoRuscJ

I then put them to a test whereby the FOV will be calculated when I zoom the camera on my android phone:

FOV1: 3.9018*Math.pow(streetViewPanoramaCamera.zoom,2) - 42.432*streetViewPanoramaCamera.zoom + 123

FOV2: Math.abs(streetViewPanoramaCamera.zoom/5*108-120

FOV3: 180/Math.pow(2,streetViewPanoramaCamera.zoom)

@Override
public void onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera streetViewPanoramaCamera) {

    Log.e("Pano", "Bearing: " + streetViewPanoramaCamera.bearing + " Tilt: " + streetViewPanoramaCamera.tilt +
            " Zoom: " + streetViewPanoramaCamera.zoom +
    " FOV1: "+ String.valueOf(3.9018*Math.pow(streetViewPanoramaCamera.zoom,2) - 42.432*streetViewPanoramaCamera.zoom + 123) +" FOV2: "+
            Math.abs(streetViewPanoramaCamera.zoom/5*108-120) +" FOV3: "+ 180/Math.pow(2,streetViewPanoramaCamera.zoom) ) ;

}

At a zoom of 0.0 on android, we have the following FOV values returned:

Since FOV has a max of 120, FOV2's formula seemed promising at first but when I zoomed at 2 times, it gave me a value of 76.8 which is far off from the actual:

This is the image on my phone after the 2 times zoom:

This is the image downloaded from Google Streetview Image API at FOV 76.8 (https://maps.googleapis.com/maps/api/streetview?size=600x300&location=-33.87365,151.20689&heading=223.11241&pitch=1.852709&fov=76.8&key=APIKEY):

This is the image downloaded from Google Streetview Image API at FOV 45 (https://maps.googleapis.com/maps/api/streetview?size=600x300&location=-33.87365,151.20689&heading=223.11241&pitch=1.852709&fov=45&key=APIKEY):

The closest I have gotten is if I made the FOV 26 but that is me guessing and not using the formulas - image below is at FOV 26:

解决方案

I finally had to regress the line to get the exponential formula out.

I used this website and manually typed in combinations of data points of both FOV and zoom values that worked well together: http://www.had2know.com/academics/regression-calculator-statistics-best-fit.html

My data points were:

FOV (ZOOM in brackets next to FOV)

120 (0)

50 (1)

45 (1.2)

37 (1.5)

26 (2)

69 (0.5)

78 (0.3)

31 (1.9)

To get a closer formula, you could continuously add on more "good-fit" data points but I just didn't have the time - anyone else who would like to perfect the formula can attempt it though.

I got the formula below where Y is the FOV and X is the zoom.

Y = 103.7587(0.5051^X)

correlation = -0.9882

这篇关于谷歌街景:FOV和缩放之间的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 21:29