谷歌街景原理

谷歌街景原理

原文:http://code.google.com/apis/maps/documentation/javascript/services.html#StreetView

翻译:任我骏驰

(转载请注明出处,标明本文地址)

创建自定义全景图(原理) (Creating Custom Panoramas)

Each Street View panorama is an image or set of images that provides a full 360 degree view from a single location. The StreetViewPanoramaobject uses images that conform to the equirectangular (Plate Carrée) projection. Such a projection contains 360 degrees of horizontal view (a full wrap-around) and 180 degrees of vertical view (from straight up to straight down). These fields of view result in an image with an aspect ratio of 2:1. A full wrap-around panorama is shown below.

每一个谷歌街景(Street View)全景照片其实是一张或一组提供了从一个地点360度全景视角的照片。街景全景照片是用了遵循“等矩形投影”(equirectangular (Plate Carrée) projection)的图片。这样的一个投影包括了一个360度的水平视野(完整地绕一周)和一个180度的垂直视野(从正上方到正下方)。这样的视野(fields of view)形成了一张宽高比为2:1的图片。一张完整的环绕一周的全景照片如下图。

谷歌街景原理_第1张图片

Panorama images are generally obtained by taking multiple photos from one position and stitching them together using panorama software. (See Wikipedia's Comparison of photo stitching applications for more information.) Such images should share a single "camera" locus, from which each of the panorama images are taken. The resulting 360 degree panorama can then define a projection on a sphere with the image wrapped to the two-dimensional surface of the sphere.

全景照片通常是通过从一个位置拍多张照片并用全景图片软件将它们拼接在一起制作而成的。(详情可以查看维基百科的比较照片拼接应用程序的文章。)要拍摄这一组全景照片应当让相机安放在一个固定的点上。这样产生的360度全景照片就可以定义成是一个包裹在球体二维表面上的投影。

谷歌街景原理_第2张图片

Treating the panorama as a projection on a sphere with a rectilinear coordinate system is advantageous when dividing up the image into rectilinear tiles, and serving images based on computed tile coordinates.

把全景图当成是在球体上的投影,并用一个直角坐标系来描述。当需要把图片分割成直角瓦片,并通过计算瓦片坐标提供相对应的图片时,这样做是很有好处的。

创建自定义的全景图瓦片(Creating Custom Panorama Tiles)

Street View also supports different levels of image detail through the use of a zoom control, which allows you to zoom in and out from the default view. Generally, Street View provides five levels of zoom resolution for any given panorama image. If you were to rely on a single panorama image to serve all zoom levels, such an image would either necessarily be quite large and significantly slow down your application, or be of such poor resolution at higher zoom levels that you would serve a poorly pixellated image. Luckily, however, we can use a similar design pattern used to serve Google's map tiles at different zoom levels to provide appropriate resolution imagery for panoramas at each zoom level.

谷歌街景也支持不同级别的图片细节。这样就允许你从默认视野进行缩放控制。通常来说,谷歌街景为每一处全景照片提供了5个级别的缩放分辨率。要是你想通过用单独一张全景图片就完成所有级别的缩放,这样的一张图片要么需要相当大,而这会明显让你的程序变慢;要么这图片的分辨率就很低,致使当放大时就变成了一个糟糕的马赛克图像。然而,幸运的是,我们可以用一种类似用在谷歌地图瓦片上的设计模式来为各个缩放级别的全景图片提供合适的分辨率图像。

When a StreetViewPanorama first loads, by default it displays an image consisting of 25% (90 degrees of arc) of the horizontal breadth of the panorama at zoom level 1. This view corresponds roughly with a normal human field of view. Zooming "out" from this default view essentially provides a wider arc, while zooming in narrows the field of a view to a smaller arc.

当一个谷歌街景图像初次载入,默认情况下,它处在缩放等级1,这时显示了整张全景照片25%的水平宽度(90度的水平视野)。这个视野大致符合一个正常人的视野。从这个默认视野进行“缩小”本质上是提供一个更广的视角,而“放大”则是将视角压窄,视角变小。

The StreetViewPanorama automatically calculates the appropriate field of view for the selected zoom level, and then selects imagery most appropriate for that resolution by selecting a tile set that roughly matches the dimensions of the horizontal field of view. The following fields of view map to Street View zoom levels:

谷歌街景全景图自动为所选择的缩放级别计算合适的视野,然后通过选择一系列大致匹配当前水平视野尺寸的对应的图像瓦片,来选择最适合该分辨率的图片。

下面是视野与街景地图缩放级别的对照表:

街景缩放级别

Street View zoom level

视野(角度)

Field of View (degrees)

0

180

1 (默认级别)

90

2

45

3

22.5

4

11.25

Note that the size of the image shown within Street View is entirely dependent on the screen size (width) of the Street View container. If you provide a wider container, the service will still provide the same field of view for any given zoom level, though it may select tiles more appropriate for that resolution instead.

要注意,在街景中图片所显示的尺寸完全依赖于屏幕用来展示街景的容器的尺寸(宽度)。如果你用一个比原先更宽的容器来显示街景,服务将仍然提供在某个缩放等级下相同的视野,尽管它可能会换用更适合当前分辨率的一些图像瓦片。

Because each panorama consists of an equirectangular projection, creating panorama tiles is relatively easy. As the projection provides an image with an aspect ratio of 2:1, tiles with 2:1 ratios are easier to use, though square tiles may provide better performance on square maps (since the field of view will be square).

因为一个全景图片是由一个“等矩形投影”组成,这样创建全景图像瓦片就会相对简单。尽管正方形的图像瓦片可能会在正方形的地图上提供更好的表现(因为视野将是正方形),但因为投影的图像的长宽比为2:1,所以2:1比例的图像瓦片用起来就会更简单。

For 2:1 tiles, a single image encompassing the entire panorama represents the entire panorama "world" (the base image) at zoom level 0, with each increasing zoom level offering 4zoomLevel tiles. (E.g. at zoom level 2, the entire panorama consists of 16 tiles.) Note: zoom levels in Street View tiling do not match directly to zoom levels as provided using the Street View control; instead the Street View control zoom levels select a Field of View (FoV), from which appropriate tiles are selected.

2:1比例的图像瓦片的情况下,一个单张环绕整个全景的图片就展现全部的全景“世界”(即源图片),这样的缩放级别(zoomLevel)为0级。随着缩放的增大,将需要4zoomLevel 块图像瓦片。(例如,在2级,整张全景图就要由16块图像瓦片组成。)注意:在铺瓦片时用的缩放等级并不直接对应控制街景视野的缩放等级;而是街景通过哪些砖块适合被选择,来控制缩放级别来选择一个视野(Field of View (FoV))。

谷歌街景原理_第3张图片

Generally, you will want to name your image tiles so they can be selected programmatically. Such a naming scheme is discussed below inHandling Custom Panorama Requests.

通常来说,你会要命名你的图像瓦片,这样它们才能被程序化地选择。这样的一个命名体制将在处理自定义全景图请求部分所讨论。

(转载请注明出处,标明本文地址)

你可能感兴趣的:(Computer,Vision,谷歌全景)