Let's get back stereo rig.
We have two pinholes with a known focal length f,
and we wish to recover the depth z of a point p.
We happen to know that the projection of p on the two image planes is somewhat different.
Over here we call it x1 for the first imager.
Over here we call it x2 for the second imager.
The question is what is the formula that allows us to look at this rig over here
with two images with a known baseline b to recover the depth z
from the relative displacements x1 and x2.
There happens to be a relatively simple answer.
If you look at this big triangle over here, that triangle has the same proportions
and the triangle put together by this little thing over here and this thing over here.
You move these two triangles over here together into a single triangle.
It looks like this.
The proportions of this triangle over here are the same
as the proportions of this triangle over here.
Specifically, the length back here is x2 minus x1.
This distance over here is f, the length over here in the baseline b,
and this length over here is the unknown depth z.
If we transform this and solve it for z,
we get z equals f times b over x2 minus x1.
If we look at the relative displacement of a point in these two different camera images,
which is x2 minus x1, you'll find the the actual depth is inversely proportional,
but in this case linearly with the focal length f and the baseline b.
These are all things we know. The baseline and the focal length are constants.
They're called intrinsics.
These are measurements, and from this we can actually recover the real depth.
Let's just try to practice this.
ではステレオリグの話をしましょう
焦点距離fが分かっているピンホールが2つあり
点Pの奥行きzを復元したいとします
2つの画像平面上のPの投影図は
異なることが分かっています
1つ目の像の位置をx₁とし
2つ目の像の位置をx₂としましょう
ではこのリグを見るには
どのような式を使えばよいかを考えてください
なお2つの像についてはx₁とx₂の相対変位から
奥行きzを求めるための基線長Bが分かっています
答えは簡単に出るかもしれません
この大きな三角形を見てください
三角形の比率は小さな2つの三角形を
結合してできる三角形の比率と同じです
2つの三角形を合わせるとこのようになります
この三角形の比率は
こちらの三角形の比率と等しいです
つまりここの長さはx₂-x₁で
ここの距離はfでここの長さは基線長Bです
こちらの長さは未知の奥行きZです
変換してzを求める式にすると
z=f×B/(x₂-x₁)となります
2点の相対変異を見てみましょう
相対変位はx₂-x₁でこれを見ると
実際の奥行きは反比例することが分かりますが
この場合焦点距離f
そして基線長Bと共に直線的に変化します
これらはすべて私たちが分かっていることです
基線長と焦点距離は定数です
これらは内因性と呼ばれます
これらは測定値でここから奥行きを復元できます
では実際に演習をしましょう