四方环视社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 5390|回复: 6
收起左侧

PTGUI官网英文原版“视点校正”教程

[复制链接]
东郭先生 发表于 2012-11-19 15:13:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
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. 8 {0 L! t+ v4 ^" t/ w- n
  {! V  o' M+ _7 B8 @1 s
Viewpoint correction is included in PTGui Pro only; the regular version of PTGui does not include this feature.
/ Z: i, ^: V. S7 FParallaxWhen 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: ; ]# [$ P% Q1 R( h

7 B- N; t& b; ^2 F' b3 ?3 l parallax1.jpg     parallax2.jpg ; q! N! f" m, q0 k, X  Z

4 C& ?7 F% h6 ~) t# h$ OThese 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.
; z; |, p# g- o, g3 O- F# l% f
, |& P+ y' E% uIt'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. / N1 w3 J) C/ A- D2 T6 y! ]- s

& |# t: n! L6 t9 R# G- }, e% ~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: ) e& V# c4 f* {- z
Perspective correction of flat imagesWhen 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: " y- }# s  V6 b' c; G, b( n) p
" P7 u, W- e" c2 o: j. O
billboard1.jpg     billboard2.jpg 4 H0 R" ]: a. F# T2 `

( N3 o0 L% x% d8 a5 }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.
# R3 B: `9 k& U+ P
2 ~- }8 n% e  P/ g( xBut 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: $ N) m# B: C' J% ]4 ~: N5 U9 N5 ^

1 j& t* i2 p8 s5 U" h5 G billboard3.jpg   D3 l7 u, \' M) n
5 o/ V$ h0 N: m0 Y
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.
. Z9 U) P- e8 l% k5 v+ S
, Z6 n( _6 Y# m& T. E( NSince 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. 3 a7 g+ S, _! S6 ]
Viewpoint correction in PTGui ProViewpoint 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. : K4 [1 e8 r( I9 B  i, `6 [7 N
$ b& I$ D3 K, T8 d% @
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.
, E7 [$ x" K! P, V7 GExampleWe have the following four images (Raffles Quay, Singapore):
5 T1 W1 A2 L) t% x$ s4 X# x: L9 T+ [: \" X
IMG_2619.jpg    IMG_2620.jpg    IMG_2621.jpg    IMG_2622.jpg   
/ u) d% M# G' Q- G/ z8 `6 R# O! @  a7 d2 q& C' `
Download example images and project files (10 MB Zip file) 0 M4 {$ \# ?9 v% G# {' D+ r3 l

- G6 j# T) j& E! t8 I" s$ AStart 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): 8 I  t) p4 F. G0 \' u+ T: K3 m5 i
3 ~% l+ j1 m, N! v
step1.jpg
! k  ?1 @6 Q  e9 j- G: y8 O  u$ m8 p7 @
5 D5 P, Y5 B  A" y3 i# A, E. P# _8 hIn 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).
% U3 ~8 X7 y) f( v
, R* [* j; E( T6 o$ m7 N! HSince the camera was tilted slightly upwards the zenith is covered but the nadir is not. A nadir shot was taken to cover this hole:   Q, Z3 {0 r6 f4 t* {' n
( w, J% d. [0 w/ k0 L2 h: G
nadir.jpg
# Z2 G5 g: n. h
7 n* Q& R' e$ L3 W( Q0 T/ ]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. * O7 z9 Q; B9 h2 `4 {3 A' H
( k/ ^7 s/ D! f% ^
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:
( {; ~0 M7 o. i% w4 ^' _' t  b) p$ ~! Z) G: t
cps_floor.jpg 6 C, y5 \3 V- ^! `: s

" S9 s8 c0 t, M9 b4 A4 BDo this for all 4 images (step3.pts).
+ Z( C5 A) }6 ^" M- `% L% M7 z( p8 m4 l5 F
If we try to optimize the project (by pressing F5), the result is very bad (step4.pts): 5 `/ v' A$ J; Q. L" w+ F% W

1 b0 S' d; i4 w, U1 ~4 L badopt.gif 9 B& ?& L+ e- Q7 `( x1 _1 E

9 Q1 ?" e$ w6 a) tThe 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: ! a/ E1 b, z4 E( k. J3 K6 u9 M
0 i4 w# M) U0 y9 K
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):
" `; Z* o: _9 z; ], U
' N$ h& u* t) j3 h, |2 h' z) ~ opt1.jpg & X+ a6 E- D5 o% l
  |' D- q) e# Q3 y: E$ x
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. 5 I  \: M- L: u4 M4 G
/ L& a' ^* z  _8 c, l
Now enable the control points of image 4 again, and enable the Viewpoint optimization for image 4 (step6.pts): , z3 {0 E; [4 Y) s0 r6 |" W

/ n* ^: {" r5 O% [ opt2.jpg 5 `" B- o& F6 r4 ?( _: e$ z+ t0 d
: Q" t$ a" X4 o7 S
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: , ]: S; g+ Q& C; R7 u

% l) a" ], B2 [ goodopt.gif
! ~; g, |  [) l5 S" a
7 q- R5 w! P. b9 |" ^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. $ V2 Z+ A7 W2 f

" L, ~+ s# L  ~/ {View the resulting panorama interactively (requires Flash 9).
2 W  @" T6 }+ ]: {2 V# w: x8 [8 J6 |
5 U. n; E6 U- v4 q8 _4 u% wThere'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: / a9 ?, J4 U$ F; ?

9 }4 O: |! z; Z/ M9 u cubes.jpg
7 n1 W2 }9 g. i4 r* y6 H7 }3 P0 c# [' h5 l) K7 _" A+ G7 G
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. # _6 c0 t' u. y/ X6 [% z5 {
+ i7 K, U$ i5 y& C$ ^
The result is a perfect nadir:
8 F/ m* W. ^6 d# i3 H, V/ N$ W) I" }  L5 h1 q$ Q0 `( B
View the resulting panorama interactively (requires Flash 9). ; Y/ ?3 K' v( s! q0 a% G( l
TroubleshootingIt'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: - h3 m$ Q7 i" i* Q
    # l( n+ O# j9 }' D  p* o3 b

    4 X# `+ p' H7 a2 f0 H
      N# {" Q$ g8 z) ?# Z. j/ [
  • In the Image Parameters tab set all VP values to zero.
  • 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.
  • 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.
  • 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.- r+ t; s8 j# S* g3 C. z
If the optimizer still reports a bad result, try the following: % V6 D3 G/ n- a" K

    8 l/ F, L3 a' c; W
    ) h' |3 w6 d" ?/ o
    3 w! d( E) Q7 U  k8 V' o
  • 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.
  • 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.
  • Run the optimizer
  • 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.& j8 @; G3 }; F2 {& P' Z
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. 3 w( v8 C# K( M$ F( G: w8 s

$ F' I2 X# x% ^, J% S0 t0 j这么好的教程,看不懂,怎么办,该怎么办才好,各位前辈能否帮忙翻译了,或者提供些类似的教程,很想了解这方面的知识。
虚若 发表于 2012-11-19 17:47:45 | 显示全部楼层
看不懂
birdman 发表于 2012-11-21 23:20:24 | 显示全部楼层
拿着字典学习!
 楼主| 东郭先生 发表于 2012-11-23 08:41:07 | 显示全部楼层
tangkunlin 发表于 2017-4-10 21:06:35 | 显示全部楼层
又是英文,看不懂啊,老大!!!
向上倾斜45度 发表于 2017-5-9 16:20:18 | 显示全部楼层
百度翻译不靠谱啊,跪求中文版的:'(
鱼眼龙 发表于 2017-5-14 11:21:16 | 显示全部楼层
向上倾斜45度 发表于 2017-5-9 04:20 PM
  {8 |: H2 ?$ }- i8 R6 s4 w百度翻译不靠谱啊,跪求中文版的
  ?- H9 B$ y  B* N
要看中文版的,请移步 https://chinavr.net/t/11290/1/1
4 _) |3 \6 E/ F! p* F* q( g/ i) U) c. d5 c7 L
我自己根据实战经验,也写了一个简易的教程,尽量简化的一个简易教程:https://chinavr.net/t/11245/1/17 O, j- \) ^( o) |! G
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|网站帮助|关于我们|联系我们|四方环视社区 ( 京ICP备16029184号-5

GMT+8, 2019-9-15 06:43 PM , Processed in 0.057619 second(s), 27 queries , Gzip On, XCache On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表