Classiclll's Blog

an old boy

元塾講師、有志、あるいは私自身への宿題

イメージ 1

イメージ 2

元塾講師、有志、あるいは私自身への宿題

二本目のWiiリモコンを入手した。
で、次の宿題を解かなければならないハメに・・・

【問1】
任意の三角形(の二次元頂点座標)が与えられている。(カメラ座標系)
各頂点にはラベルが(A,B,Cのように)ふられており、各ラベルの空間座標は既知のものとする。(例えば、A(0,0,0),B(0,1,0),C(1,0,0))

(1-0)
 カメラ画像上の正規化座標(u,v)にある点への(空間)方向ベクトルを適当な定数を定めて求めよ。【5/7追加】【2009/5/9修正】
with the figure 2, we can take
 directinal vector [d]= [dc].rotate(up_dir, (u-0.5)/2/PI/K).rotate(right_dir, (v-0.5)/2/PI/K)
    where [dc] is the center directional vector from the converjense location,
                and K is the radius.

(1-1)
 視点を原点に取った時、三点の空間座標を(カメラ空間座標系で)求めよ。
<Formulation>
 [Pi]:the i-th reference point
and
 |[Pj-Pi]|=Lij, (i!=j)
and
 [di]:the directional vector to [Pi]
then each reference point is on the line
 [Pi]=ti*[di]
and
 Lij^2 = ([Pj]-{Pi])*(same)
      = (tj*dj-ti*di)*(same)
      = tj^2 - 2*tj*ti*([dj]*[di]) +ti^2
let cij=([dj]*[di]), then we get the followings
 tj^2 - 2*cij*tj*ti + ti^2 - Lij^2 = 0
the root of the above equation system [t*] can be obtaind by the following metod.

<Generalized Problem>
 find [x] in Real^n such that
   F([x]) = [fi(x0,x1,...,xn)] = [0]

<Newton Method>
 consider the following series of vector [x]k, k=0,1,2,....
   [x]k = [x]k-1 - Dlt(k)
   [x]0 = initial value, given.
let J(F([x])) be
   J(F([x])) = {fij([x])} = {PD.by(xj) fi([x])}
and, let Dlt(k) = (J(F([x]k)))^(-1) * F([x]k)
now we can find the value of ko such that
   |Dlt(ko) - Dlt(ko-1)| <= epsilon << 1
and [x]ko,  is the solution of the above problem.
    【解の代数的表現、継続募集中】 (クラスMatとProbが欲しくなってしまった – いずれ別記事で)

(1-2)
 カメラの焦点距離をlとした時、三点の座標情報からそのカメラ(視点)の空間位置を推定せよ。
      【2009/5/9追加】
<Formulation>
let
 [Pi]:the i-th reference point
 |[Pj-Pi]|=Lij, (i!=j)
  [di]:the directional vector to [Pi]
 and
  ti : the distance from each reference points, , given from Prob.1-1 
then the position of the view point [x*] satisfies
   |[x*]-[Pi]|^2 - ti^2 = 0. for each i
<to solve above>
  using the newton method (of class EqSys), we can get the position of the view point.

【問2】
問1の結果を踏まえて、空間座標系における上記カメラの前方向および上方向ベクトルを求めよ。

【問3】
空間座標系上で任意の相異なる二本の空間ベクトルと各々の始点座標が与えられている。それぞれのベクトルと始点で規定される直線の交点、あるいは最近接点(いずれかの直線上の点で、他方の直線との距離が最小の点)を求めよ。
< Proposition >
let the couple of start position be [A],[B]
   and the couple of unit direction be [d1],[d2]
then the point on each lines are
 - [P] = [A] + s*[d1]
 - [Q] = [B] + t*[d2]
then the nearest point on each lines are
 - s = {([d1]-cosTh*[d2])/sinTh^2}*[AB]
 - t = {([d2]-cosTh*[d1])/sinTh^2}*[BA]
  where Th is the angle between the each directions
and, the nearest distance, |[Q]-[P]| is zero when the crossed point exists.

<proof>
let dist2(s,t) = |[Q]-[P]|^2
then
 dist2(s,t)
    = |[B] + t*[d2] - [A] - s*[d1]| ^ 2
    = ([AB] + t*[d2]  - s*[d1]) * (same)
let dist2(s,t) has minimum at (so, to)
then
 (PD.by s)dist2 (so,to) = 2*(so-to*cosTh-[AB]*[d1])*(-[d1]) = 0
 (PD.by t)dist2 (so,to) = 2*(to-so*cosTh-[AB]*[d1])*(-[d2]) = 0
this implies the followings
  so = to*cosTh-[AB]*[d1]
  to = so*cosTh-[AB]*[d2]
finally, these lead to the proposition, except when sinTh^2=0 (parallel)
    Q.E.D.
   re_chestnut君に感謝! (5月7日修正)

【問4】
上記カメラが二台あり、両カメラで捉えられる部分空間が空とならないように、相異なる位置に設置されているとせよ。
空でない部分空間内の任意の位置にある輝点について、二台のカメラで捉えられた(各々のカメラ座標系の)情報から、輝点の空間位置を推定せよ。

できれば、元塾講師あるいは有志に解いてもらえると・・・楽ちん。