## ← 17-07 Solving For Depth

• 1 Follower
• 28 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=_o8qyMcZow8" data-team="udacity"></div> ``` 2 Languages

Showing Revision 1 created 11/28/2012 by Amara Bot.

1. Let's get back stereo rig.
2. We have two pinholes with a known focal length f,
3. and we wish to recover the depth z of a point p.
4. We happen to know that the projection of p on the two image planes is somewhat different.
5. Over here we call it x1 for the first imager.
6. Over here we call it x2 for the second imager.
7. The question is what is the formula that allows us to look at this rig over here
8. with two images with a known baseline b to recover the depth z
9. from the relative displacements x1 and x2.
10. There happens to be a relatively simple answer.
11. If you look at this big triangle over here, that triangle has the same proportions
12. and the triangle put together by this little thing over here and this thing over here.
13. You move these two triangles over here together into a single triangle.
14. It looks like this.
15. The proportions of this triangle over here are the same
16. as the proportions of this triangle over here.
17. Specifically, the length back here is x2 minus x1.
18. This distance over here is f, the length over here in the baseline b,
19. and this length over here is the unknown depth z.
20. If we transform this and solve it for z,
21. we get z equals f times b over x2 minus x1.
22. If we look at the relative displacement of a point in these two different camera images,
23. which is x2 minus x1, you'll find the the actual depth is inversely proportional,
24. but in this case linearly with the focal length f and the baseline b.
25. These are all things we know. The baseline and the focal length are constants.
26. They're called intrinsics.
27. These are measurements, and from this we can actually recover the real depth.
28. Let's just try to practice this.