新手入门  拍摄设备  制作软件  经验交流  商业案例  新闻资讯  官方公告  其它


Viewpoint correction


One of the more advanced features in PTGui Pro is viewpoint correction. Viewpoint correction allows one to use different camera viewpoints in the same panorama, provided that the relevant part of the images is approximately flat. It is particularly useful when including a handheld nadir image in a panorama taken from a tripod.


Viewpoint correction is included in PTGui Pro only; the regular version of PTGui does not include this feature.


Parallax   视差角度

When photographing panoramas, rule number one is to shoot all images from exactly the same viewpoint. More specifically the camera should be rotated around the 'no parallax point' (the optical center of the camera/lens). Otherwise, parallax errors will occur. The following images show an example of parallax:



These photos were taken from two different camera positions. As a result the buildings in the background have moved relative to the position of the buildings in the foreground. While this may be an extreme example, in practise even camera movements of only a few centimeters may result in visible parallax if there are nearby objects in the scene.


It's not difficult to see that parallax is a problem when stitching photographs: a stitcher can either align the objects in the foreground or the objects in the background, but not both at the same time. Even worse: the optimizer will get severely confused, unable to determine the camera and lens properties, causing misalignments in other areas of the panorama as well. Unlike other artefacts like barrel distortion, correcting for parallax errors is impossible; the best one can do is attempting to mask the misalignments by retouching the stitched panorama afterwards.

So it should be clear that in order to avoid parallax, it is important to take all images from the same viewpoint. But there is one exception: 所以应该明确,以避免视差,这是重要的是要考虑所有的图像从同一观点。但有一个例外:

Perspective correction of flat images  透视校正平面图像

When the photographed subject is completely flat, we can correct the viewing perspective by stretching the image in a specific way. In Photoshop for example the Free Transform function can be used. This is shown in the following example: 当拍摄主题是完全平坦,我们可以正确的观看角度伸展的图像在一个特定的方式。在PS图象处理软件例如自由变换功能可以使用。这是显示在下面的例子:


The first image shows the original photograph of a billboard, taken from the side. The second image is extracted from the first and transformed into a rectangular shape. The second image looks identical to a photo taken from a point in front of the billboard. So by transforming the image we have 'virtually' moved the camera position from the side of the billboard to in front of the billboard. 第一个图像显示原始照片的广告牌,从侧面。下的图像中提取第一和转化成一个长方形的形状。二图像看起来相同的照片,从一个点前面的广告牌。所以通过改变我们几乎'移动摄像机的位置从侧面的广告牌前的广告牌。

But this only works if the photographed subject is flat. If we would apply the same transformation to a larger part of the image, anything in front or behind the billboard surface would become severely stretched: 但这只能如果拍摄的主题是平的。如果我们将采用同样的转换到一个较大的图像的一部分,任何在前面或后面的广告牌表面变得严重紧张:

Although a panorama rarely consist of just a flat surface, this technique is still useful for panoramas. When photographing a spherical panorama, taking the nadir image (with the camera facing downwards) can be a challenge: in order to hide the tripod from the panorama, the photographer has to move the tripod away and shoot the nadir image hand held. It's nearly impossible to hold the camera at exactly the same viewpoint as the other images. Furthermore, the down facing image will inevitably include the photographer's feet, which have to be masked away. And finally, on a sunny day it is unavoidable to have the camera's (and the photographer's) shadow somewhere in the panorama. 虽然一个全景很少只包括一个平坦的表面,这种技术仍然是有用的全景。当拍摄一个球形全景图像,以最低点(与相机朝下)可以是一个挑战:为了要隐藏从全景三脚架,摄影师将鼎,拍摄图像手持最低点。这几乎是不可能拿着相机在完全相同的观点为其他图像。此外,向下面临的图像将不可避免地包括摄影师的脚,其中有被掩盖了。最后,在一个阳光灿烂的日子,这是无可避免的相机(与摄影师的影子在全景)。

Since many panoramas actually have a flat surface in the nadir (like a level street, or the floor in a room), these problems can be overcome by not having the camera in the same viewpoint when shooting the nadir image, and using the technique explained above to correct for the camera position offset. This is exactly what the viewpoint correction function in PTGui Pro does. 由于许多全景实际上有一个平坦的表面的最低点(如街道,或在室内的地面),这些问题是可以克服的,不具有相机在同一角度拍摄时的最低点,和使用的技术解释正确的摄像机的位置偏移。这究竟是什么软件校正功能ptgui可以做到呢。

Viewpoint correction in PTGui Pro  ptgui角度校正功能

Viewpoint correction is controlled by two groups of parameters: the Image Parameters tab (visible in Advanced mode) contains five parameters, labeled 'VP ...'. Further, the Optimizer tab (in Advanced Optimizer mode) has a checkbox labeled 'Viewpoint' for each image. By checking the checkbox, the optimizer will optimize the five 'VP ...' parameters, based on the given control points. The VP parameters perform a translation in 3 axes and a rotation along 2 axes. It's not necessary to understand their meaning since the values are determined by the optimizer. 角度校正是由2组参数:图像参数表(可以在高级模式)包含五个参数,标记的副总裁……”。此外,优化器标签(在先进的优化模式)都有一个复选框标记'观点'为每个图像。通过检查的复选框,优化器将优化五个坐标参数,根据给定的控制点。左边参数进行翻译和旋转的3轴沿2个坐标轴。这不是要明白自己的意思,因为价值是确定的优化器。

Since viewpoint correction only works on flat surfaces, any image which is viewpoint corrected must only have control points placed on a single flat surface. So when used in the nadir image, that image should have control points only on the floor. Therefore control points must be placed by hand; the control point generator in PTGui cannot tell whether a certain point is on the floor or not. The best results are achieved when using many control points (at least 10 is recommended), spread across the surface. With too few control points, or too closely spaced control points, the optimizer may get stuck, unable to determine the viewpoint. 由于观点修正只能在平坦的表面,任何形象,是纠正必须只能有控制点放在一个平坦的表面。所以使用时的最低点的图像,图像应该有控制点只在地板上。因此,控制点必须放在手;控制点发生器在ptgui不能告诉是否一定是在地板或不。最好的结果是实现当使用控制点(至少10是推荐),横跨表面。太少的控制点,或过于密集的控制点,优化器可能会卡住,无法确定的观点。

Example  范例

We have the following four images (Raffles Quay, Singapore): 我们有以下四个图像(莱佛士码头,新加坡):


Download example images and project files (10 MB Zip file) 

Start PTGui, add the four images (img_2619.jpg to img_2622.jpg) to a new project and press Align Images. PTGui analyzes the images, adds control points and aligns the images. This results in the following preview (step1.pts): 开始ptgui,添加四个图像(img_2619.jpg到img_2622正门。)到一个新的项目,并按调整图像。ptgui分析图像,添加控制点和对齐图像。这个结果在下面的预览(1附图):

In this example the alignment of the images can be improved a little more by editing control points: remove the control points which PTGui placed on (moving) clouds. Also we add a few extra control points at the top of the skyscrapers and on the tiles of the floor, to get a more even distribution of the control points across the entire image area. Choosing 'Minimize lens distortion: Heavy + Lens Shift' on the Optimizer page will give a better correction of lens distortion and compensate for the slight offset of the cropping circle to the actual image circle. Press F5 to optimize. This results in an average control point distance of 0.85, which is very good (step2.pts). 在这个例子中图像的对齐方式可以改善一点更多的编辑控制点:删除控制点,ptgui放在(移动)云。我们也可以添加一些额外的控制点在顶部的摩天大楼的地砖,以获得更均匀分布的控制点在整个图像面积。选择尽量减少镜头失真:重心+镜头移位的优化器页将提供一个更好的校正透镜畸变和弥补略有偏移的种植到实际图像中的圆。按运营优化。这样的结果是一个控制点的平均距离为0.85,这是非常好的得分F5。

Since the camera was tilted slightly upwards the zenith is covered but the nadir is not. A nadir shot was taken to cover this hole: 由于相机倾斜由上向下拍摄。最低点的镜头是圈黑的井盖。

To demonstrate the effects of parallax this nadir shot was deliberately taken with a large viewpoint offset: the camera was moved at least a meter from the original shooting position. The camera was at a different height as well, and tilted towards the point on the floor below the original shooting position. 表明视差的影响这一最低点是故意采取一个大角度偏移:照相机移动了至少一个单位从原来的拍摄位置。相机在不同高度和倾斜等,对准下方的地面上原有的拍摄位置。 

Add the nadir shot to the project by dragging it (nadir.jpg) into the PTGui window. As explained above, we need to add control points for the nadir image by hand, and all control points in the nadir image must be on the ground surface: 加奈迪尔拍摄项目的(最低点。图片)到ptgui窗口。如上面所解释的,我们需要添加控制点图像的最低点,和所有的控制点的最低点的形象必须在地面上

Do this for all 4 images (step3.pts). 这样做的所有4个图像(依次校正)。

If we try to optimize the project (by pressing F5), the result is very bad (step4.pts): 如果我们试图优化项目(cols),结果分数会很差:

The misalignment is of course caused by the camera offset of the nadir image, which the traditional image alignment model in PTGui cannot cope with. But let's enable the viewpoint correction: 偏差的过程所造成的相机偏移的最低点,而传统的图像对齐模型在ptgui无法应付。但让我们使角度校正:

Switch the Optimizer to Advanced mode by pressing the Advanced button on the Optimizer tab. First we optimize the project without the control points of the nadir image. This enables PTGui to determine the proper lens parameters, without being distracted by the viewpoint offset in the nadir image. We do this by unchecking 'use control points of image 4' (step5.pts): 

Press F5 to run the optimizer; the result should again be 'very good', and the first 4 images are actually aligned the same as they were before the nadir image was added. 按F5运行优化;结果应再次'非常好',和前4个图像实际上是赞同他们与以前的相同的图像被添加。

Now enable the control points of image 4 again, and enable the Viewpoint optimization for image 4 (step6.pts): 现在,使控制点的图像4,并使观点优化图像4(第六步高分)

Again press F5 to run the optimizer. Note that the result is now 'very good', even with the nadir image included in the optimization. And this is what the alignment looks like in the panorama editor: 再次按下键运行优化。请注意,结果现在'非常好',甚至与最低点形象包括在优化。这样在全景图编辑器看起来就很好了:

As we see the alignment on ground level is nearly perfect, despite the viewpoint offset. Note that anything above or below ground level is misaligned, such as the black cubes at the river side. Indeed, the viewpoint correction only works for a single flat surface; objects below or above the surface will suffer from parallax. 正如我们所看到的对准地面几乎是完美的,尽管角度偏移。请注意,任何高于或低于地面水平对齐,如黑色立方体在河边。事实上,观点修正只能为一个单一的平面的上方或下方;物体表面会受到视差。

View the resulting panorama interactively (requires Flash 9). 查看生成的全景交互(需要9闪光)。

There's still one problem in the generated panorama: the blender has used part of the nadir images at the black cubes, which are not at ground level: 还存在一个问题在生成全景图:在搅拌机中常用的部分图像在黑色立方体的最低点,而不是在地面:

This is easily solved using the 'Blend priority' parameter. Go to the Image Parameters tab and reduce the blend priority of the nadir image from 100 to 25 (step7.pts). This causes the blender to use only the central part of the nadir image (plus a bit of additional overlap). See the online help for the Image Parameters tab in PTGui Pro for more information. 这是很容易解决使用“混合优先参数。到图像参数表和减少混合优先的图像从100到25的最低点(STE P7警校。)。这使搅拌器使用只有中央部分低潮的图像(加上一些额外的重叠)。请参阅联机帮助图像参数ptgui亲标签的更多信息。

The result is a perfect nadir: 其结果是一个完美的最低点:

View the resulting panorama interactively (requires Flash 9). 查看生成的全景交互(需要9闪光)。


It's possible that the optimizer gets stuck in a local minimum when trying to optimize the viewpoint, resulting in a 'very bad' optimization result. The optimization is less stable than normal due to the large number of parameters to be optimized for the nadir image, and the fact that there is a lot of dependency between those parameters. You can help the optimizer by providing a reasonable starting point. This can be done as follows: 这是可能的,优化卡在当地最低在试图优化的观点,造成了很坏的优化结果。优化是更稳定的比正常由于大量参数进行优化的最低点,而事实上,有很多的依赖这些参数。你可以帮助优化提供了一个合理的起点。这可以做如下:

1.       In the Image Parameters tab set all VP values to zero.

2.       Optimizer: disable Viewpoint optimization for all images, enable 'use control points of:' for all images and optimize. This will give a bad optimization result (similar to the bad result shown above), but brings the nadir image into the appropriate orientation.

3.       Uncheck 'use control points of:' for the nadir image, leave Viewpoint optimization disabled and optimize again. This should give a good result, and set the lens parameters to the correct values.

4.       Now the optimizer should have a good starting point. Enable 'use control points of:' for the nadir image, enable Viewpoint optimization for the nadir image, and optimize again.





If the optimizer still reports a bad result, try the following: 如果优化器还报告不好的结果,尝试以下:

1.             Set the pitch of the nadir image to -90, and the yaw to 0. Reset the 5 viewpoint parameters of the nadir image to 0.

2.             On the Optimizer tab, disable the optimization of yaw and pitch of the nadir image and enable viewpoint optimization of the nadir image. Enable 'use control points of:' for all images.

3.             Run the optimizer

4.             If the optimizer reports a good or 'not bad' result, it has probably found the right position of the nadir image. Now enable yaw and pitch optimization for the nadir image and run the optimizer again.

1。设置间距的最低点形象,- 90,和偏航0。重置5个角度参数的最低点的形象0。




If this still doesn't help, review the control points of the nadir image and make sure you didn't accidentally misplace one. A single faulty point is enough to break the optimization. Adding a few more control points, spaced across the entire nadir surface (don't forget to place control points on distant features on the nadir surface), may further help the optimizer in finding the VP parameters. Sometimes a little trial and error is necessary, by removing some control points and adding others. After each modification, start from step 1 mentioned above, until the optimizer reports a good result. 如果仍然没有帮助,审查控制点的最低点的形象,确保你不小心把一。一个单一故障点足以打破优化。添加更多的控制点的间距,整个低潮面(不要忘记的地方控制点在遥远的功能上的最低点的表面),可进一步帮助寻找副参数优化。有时一个小试验和错误是必要的,以消除一些控制点,加上其他点。每次改动后,从步骤1所述的开始,直到优化器报告一个好的结果。

Try it!

Download example images and project files (10 MB Zip file) 

Download the trial version of PTGui Pro

PTGui and PTGui Pro are products of New House Internet Services B.V., Rotterdam, The Netherlands.
The PTGui and PTGui Pro software, related documentation and all contents on this site are © Copyright 2000-2012 New House Internet Services B.V., Rotterdam, The Netherlands. All rights reserved. ptgui和ptgui专业产品的新家互联网服务有限公司,鹿特丹,荷兰。


本文转载自 元荣大宝  用PTGui进行视觉校正译文—解决手持倾斜拍摄补地!  (出处: 中国全景摄影论坛)

0 评论

当前在线 0   最高在线 59   文章 1364   版块 28   标签 23   评论 1389