跳到主要内容

東京大学 情報理工学系研究科 創造情報学専攻 2009年8月実施 筆記試験 第2問

Author​

itsuitsuki

Description​

出典:大学公式問題冊子の保存版。 Answer the following questions.

(1) As Figure 1 shows, an orthogonal coordinate frame ΣC\Sigma_C of a camera with the lens axis CZCZ and the projection plane SS is placed at the point CC. The plane SS is orthogonal to the lens axis CZCZ and has the distance ff from CC. The point QQ is projected to the point PP on the plane SS with the coordinates PC=(PX,PY,f)t\mathbf{P}_C=(P_X,P_Y,f)^t in ΣC\Sigma_C. The coordinates of three orientation vectors CX,CY,CZCX,CY,CZ are described as XW=(XX,XY,XZ)t\mathbf{X}_\mathbf{W}=(X_X,X_Y,X_Z)^t, YW=(YX,YY,YZ)t\mathbf{Y}_\mathbf{W}=(Y_X,Y_Y,Y_Z)^t and ZW=(ZX,ZY,ZZ)t\mathbf{Z}_\mathbf{W}=(Z_X,Z_Y,Z_Z)^t, and the position vector of CC is CW=(CX,CY,CZ)t\mathbf{C}_\mathbf{W}=(C_X,C_Y,C_Z)^t in the coordinate frame ΣW\Sigma_W. The superscript tt indicates transpose.

Assume the distance from CC to QQ is dd, show the vector QC\mathbf{Q}_C from the point CC to the point QQ with PC\mathbf{P}_C and dd. When the vector QW\mathbf{Q}_\mathbf{W} is the position vector of QQ and the rotation matrix of ΣC\Sigma_C is RCR_C in ΣW\Sigma_W, we have QW=RCQC+CW\mathbf{Q}_\mathbf{W}=R_C\mathbf{Q}_C+\mathbf{C}_\mathbf{W}. Show the elements of the rotation matrix RCR_C.

(2) When we observe the point QQ from the camera placed at a point AA, the projection point is PA=(aX,aY,f)t\mathbf{P}_A=(a_X,a_Y,f)^t in the camera coordinate frame ΣA\Sigma_A. Then, we translate the camera with the distance ℓ\ell along the axis XX to a point BB and rotate it around the axis YY of the translated coordinate frame with the angle α\alpha. The rotated camera coordinate frame is ΣB\Sigma_B. The projection point becomes PB=(bX,bY,f)t\mathbf{P}_B=(b_X,b_Y,f)^t in ΣB\Sigma_B. Show the method to get the distance dAd_A from AA to QQ and the distance dBd_B from BB to QQ, when PA=PB\mathbf{P}_A=\mathbf{P}_B is obtained. Assume there is no error in the translation and rotation, and the XZXZ planes of ΣA\Sigma_A and ΣB\Sigma_B are aligned in the same plane.

(3) Two cameras are placed at the points MM and NN, respectively. Let the position vectors of MM and NN be MW\mathbf{M}_\mathbf{W} and NW\mathbf{N}_\mathbf{W} and the rotation matrices be RMR_M and RNR_N. The projection points of QQ on these two cameras become PM\mathbf{P}_M and PN\mathbf{P}_N. As the position vectors QM\mathbf{Q}_\mathbf{M} and QN\mathbf{Q}_\mathbf{N} of the point QQ are the same in the coordinate frame ΣW\Sigma_W. Denote the condition which the projection points PM\mathbf{P}_M and PN\mathbf{P}_N should satisfy.

(4) Assume the projection points are described in an array and the condition in (3) is not satisfied. Let the evaluation function be J=∣(RMQM+MW)−(RNQN+NW)∣2J=|(R_M\mathbf{Q}_M+\mathbf{M}_\mathbf{W})-(R_N\mathbf{Q}_N+\mathbf{N}_\mathbf{W})|^2, and consider minimizing JJ to get QW\mathbf{Q}_\mathbf{W}. Let dMd_M and dNd_N be the distances from MM and NN to QQ, respectively, when JJ is minimized. Denote dMd_M and dNd_N. Then explain the method to get QW\mathbf{Q}_\mathbf{W} in ΣW\Sigma_W with dMd_M, dNd_N.

(5) Explain the best arrangement to minimize errors when we measure a three dimensional position by two cameras such as (3).

题目描述​

回答以下相机投影与三维重建问题。

  1. 如图 1,在点 CC 建立相机正交坐标系 ΣC\Sigma_C,镜头轴为 CZCZ,投影平面 SS 与 CZCZ 正交且距 CC 为 ff。空间点 QQ 投影到 SS 上的点 PP,其相机坐标为 PC=(PX,PY,f)t\mathbf P_C=(P_X,P_Y,f)^t。在世界坐标系 ΣW\Sigma_W 中,相机三轴方向向量分别为

    XW=(XX,XY,XZ)t,YW=(YX,YY,YZ)t,ZW=(ZX,ZY,ZZ)t,\mathbf X_W=(X_X,X_Y,X_Z)^t,\quad \mathbf Y_W=(Y_X,Y_Y,Y_Z)^t,\quad \mathbf Z_W=(Z_X,Z_Y,Z_Z)^t,

    光心位置为 CW=(CX,CY,CZ)t\mathbf C_W=(C_X,C_Y,C_Z)^t,上标 tt 表示转置。若 CC 到 QQ 的距离为 dd,用 PC,d\mathbf P_C,d 表示从 CC 指向 QQ 的向量 QC\mathbf Q_C。又已知

    QW=RCQC+CW,\mathbf Q_W=R_C\mathbf Q_C+\mathbf C_W,

    写出旋转矩阵 RCR_C 的各元素。

  2. 相机位于 AA 时,QQ 的投影为 PA=(aX,aY,f)t\mathbf P_A=(a_X,a_Y,f)^t。随后相机沿 XX 轴平移距离 ℓ\ell 到 BB,再绕平移后坐标系的 YY 轴旋转角 α\alpha,得到坐标系 ΣB\Sigma_B,投影为 PB=(bX,bY,f)t\mathbf P_B=(b_X,b_Y,f)^t。在观测到 PA=PB\mathbf P_A=\mathbf P_B 时,说明如何求 A,QA,Q 间距离 dAd_A 和 B,QB,Q 间距离 dBd_B。假设平移、旋转无误差,且 ΣA,ΣB\Sigma_A,\Sigma_B 的 XZXZ 平面共面。

  3. 两台相机分别位于 M,NM,N,世界坐标位置为 MW,NW\mathbf M_W,\mathbf N_W,旋转矩阵为 RM,RNR_M,R_N,对 QQ 的投影为 PM,PN\mathbf P_M,\mathbf P_N。因为由两台相机得到的 QQ 的世界坐标应相同,写出 PM,PN\mathbf P_M,\mathbf P_N 必须满足的条件。

  4. 若投影点以数组给出且不严格满足第 3 问条件,定义

    J=∣(RMQM+MW)−(RNQN+NW)∣2.J=\left|(R_M\mathbf Q_M+\mathbf M_W)-(R_N\mathbf Q_N+\mathbf N_W)\right|^2.

    通过最小化 JJ 求 QW\mathbf Q_W。设最小时从 M,NM,N 到 QQ 的距离分别为 dM,dNd_M,d_N,求 dM,dNd_M,d_N,并说明如何由二者得到世界坐标系中的 QW\mathbf Q_W。

  5. 说明用第 3 问所述双目相机测量三维位置时,为减小误差应如何布置两台相机。

Kai​

f>0f>0 とし、観測対象は両カメラの前方にあるとする。∥⋅∥\|\cdot\| はユークリッド長を表す。

(1)​

C,Q,PC,Q,P は同一直線上にあり、∥QC∥=d\|\mathbf Q_C\|=d だから、

QC=dPC∥PC∥=dPX2+PY2+f2(PXPYf).\boxed{\mathbf Q_C=d\frac{\mathbf P_C}{\|\mathbf P_C\|} =\frac{d}{\sqrt{P_X^2+P_Y^2+f^2}}\begin{pmatrix}P_X\\P_Y\\f\end{pmatrix}}.

カメラ座標の各単位軸を世界座標で表したベクトルを列に並べれば、

RC=[XW YW ZW]=(XXYXZXXYYYZYXZYZZZ).\boxed{R_C=[\mathbf X_W\ \mathbf Y_W\ \mathbf Z_W] =\begin{pmatrix}X_X&Y_X&Z_X\\X_Y&Y_Y&Z_Y\\X_Z&Y_Z&Z_Z\end{pmatrix}}.

直交右手座標系なら RCTRC=IR_C^{\mathsf T}R_C=I, det⁡RC=1\det R_C=1 である。

(2)​

ΣA\Sigma_A を計算の基準とし、A=0A=0, B=b=(ℓ,0,0)TB=\mathbf b=(\ell,0,0)^{\mathsf T} と置く。右手系の正の回転を採用すると、

Ry(α)=(cos⁡α0sin⁡α010−sin⁡α0cos⁡α).R_y(\alpha)=\begin{pmatrix}\cos\alpha&0&\sin\alpha\\0&1&0\\-\sin\alpha&0&\cos\alpha\end{pmatrix}.

P=PA=PB\mathbf P=\mathbf P_A=\mathbf P_B に対し、AA 基準での2本の単位視線を

u=P∥P∥,v=Ry(α)P∥P∥\mathbf u=\frac{\mathbf P}{\|\mathbf P\|},\qquad \mathbf v=R_y(\alpha)\frac{\mathbf P}{\|\mathbf P\|}

とする。求める点は

dAu=b+dBvd_A\mathbf u=\mathbf b+d_B\mathbf v

を満たす。γ=uTv\gamma=\mathbf u^{\mathsf T}\mathbf v, a=uTba=\mathbf u^{\mathsf T}\mathbf b, b=vTbb=\mathbf v^{\mathsf T}\mathbf b と略し、両視線との内積を取ると

dA−γdB=a,γdA−dB=b.d_A-\gamma d_B=a,\qquad \gamma d_A-d_B=b.

従って ∣γ∣<1|\gamma|<1 なら

dA=a−γb1−γ2,dB=γa−b1−γ2.\boxed{d_A=\frac{a-\gamma b}{1-\gamma^2},\qquad d_B=\frac{\gamma a-b}{1-\gamma^2}}.

これを元のベクトル式へ代入して整合性と dA,dB>0d_A,d_B>0 を確認する。投影座標が等しくても、カメラが回転していれば世界での視線は異なるので三角測量できる。反対に、視線が平行・反平行なら分母が0となり、この観測だけでは距離を一意に復元できない。回転の符号を逆に定義する場合は α\alpha を −α-\alpha に置き換える。

(3)​

世界座標での単位視線と基線を

u=RMPM∥PM∥,v=RNPN∥PN∥,b=NW−MW\mathbf u=R_M\frac{\mathbf P_M}{\|\mathbf P_M\|},\quad \mathbf v=R_N\frac{\mathbf P_N}{\|\mathbf P_N\|},\quad \mathbf b=\mathbf N_W-\mathbf M_W

とする。正の距離 dM,dNd_M,d_N が存在して

dMu−dNv=b\boxed{d_M\mathbf u-d_N\mathbf v=\mathbf b}

となることが条件である。非平行な視線について距離を消去すると、

bT(u×v)=0\boxed{\mathbf b^{\mathsf T}(\mathbf u\times\mathbf v)=0}

という共面条件(エピポーラ条件)を得る。ただし、交点が前方にあるかは正の距離を別途確認する。平行な視線ではこの式は自動的に0になるため、それだけでは十分ではなく、b×u=0\mathbf b\times\mathbf u=0 と半直線同士の重なりを調べる必要がある。

(4)​

J=∥dMu−dNv−b∥2J=\|d_M\mathbf u-d_N\mathbf v-\mathbf b\|^2 と書き、γ=uTv\gamma=\mathbf u^{\mathsf T}\mathbf v, a=uTba=\mathbf u^{\mathsf T}\mathbf b, b=vTbb=\mathbf v^{\mathsf T}\mathbf b とする。偏微分を0と置くと、

(1−γ−γ1)(dMdN)=(a−b).\begin{pmatrix}1&-\gamma\\-\gamma&1\end{pmatrix} \begin{pmatrix}d_M\\d_N\end{pmatrix} =\begin{pmatrix}a\\-b\end{pmatrix}.

∣γ∣<1|\gamma|<1 なら係数行列は正定値なので、この停留点が一意な最小点であり、

dM=a−γb1−γ2,dN=γa−b1−γ2.\boxed{d_M=\frac{a-\gamma b}{1-\gamma^2},\qquad d_N=\frac{\gamma a-b}{1-\gamma^2}}.

最近点を QM∗=MW+dMuQ_M^*=\mathbf M_W+d_M\mathbf u, QN∗=NW+dNvQ_N^*=\mathbf N_W+d_N\mathbf v とすると、その中点

Q^W=QM∗+QN∗2\boxed{\widehat{\mathbf Q}_W=\frac{Q_M^*+Q_N^*}{2}}

を再構成点として採用する。これは2本の視線を対等に扱う最近点法である。視線が交わらない場合、dM,dNd_M,d_N は各視線上の最近点までのパラメータであり、中点までの厳密な距離とは一般に異なる。

観測誤差によって上の解に負の成分が出る場合、それを物理的な「距離」として使ってはならない。dM,dN≥0d_M,d_N\ge0 を課し、内部解が可行ならそれを使う。そうでなければ、境界候補

(dM,dN)=(max⁡(0,a),0),(0,max⁡(0,−b))(d_M,d_N)=(\max(0,a),0),\qquad(0,\max(0,-b))

で JJ を比較し、小さい方を選ぶ(原点が最適になる場合も0との最大値により扱える)。∣γ∣=1|\gamma|=1 は退化しており、一意な深度推定はできない。

(5)​

視線間の角度を θ\theta とすると、上の逆行列の分母は 1−γ2=sin⁡2θ1-\gamma^2=\sin^2\theta である。ほぼ平行な視線では小さな画像誤差が大きな距離誤差へ増幅されるため、対象を共通視野に収めつつ十分な基線を設ける。対象までの距離や観測精度を同程度に固定して条件数を小さくする観点では、交差角が90度付近になる配置がよい。実際の最良配置は距離、焦点距離、画素誤差、遮蔽、対応点の見つけやすさによっても変わるため、角度だけで普遍的な最適解が決まるわけではない。両カメラの内部・外部パラメータの校正と同期も必要である。