Today, we're going to talk again about how images are formed in the camera in their all of what we call the intrinsic parameters. When we were projecting the scene into the image plane, we can see that this image depends on the relative orientation of the camera with respect to the scene. But also some parameters which are specifically the camera like the focal length which is the distance of the image plane from the projection center from our lens. And where the optical axis intersects the image plane which is the image center. Usually we get them with a process called calibration. And we have shown in the past how to compute these calibration parameters in MATLAB. Today, we're going to show a very intuitive way on how to compute the focal length and the image center from pure geometry. We felt using any projection equations. Let us come back to this image of a checkered board pattern on the floor which we have used to compute the projective transformation. In this image, we see the projection of three sets of parallel lines. Parallel lines which go to the right and when they are projected in the image, intersect at a point A called vanishing point. Another set of orthogonal width which intersects on the left on vanishing point B. And these were really the two points we could use together with the origin. And one more point, not to compute the projected summation from the ground plane to the camera image. Now we are going to introduce one more point, a vertical vanishing point. Which is as we see is the intersection of fall vertical lines and intersect at the bottom of the image at point C. What's the geometric interpretation from this vanishing points? How do they relate to how the camera is orienting respect to the world, and also how do they relate to the focal length and the image sent? Let's start with the notion the horizon. Everybody knows what is a horizon when we're looking very far at a flat field or the ocean, but horizon exists everywhere. And this is nothing else than what we call the line at infinite. This is the line where parallel lines in the world. Like the two sets of the yellow parallel lines here, when they're intersecting in the image are two points. Let's say A and B, then the horizon is the line defined by A and B. And we see that many other parallel lines can intersect at this horizon. Like for example the parallel which are parallel to this corner we see, they also intersect at the horizon AB. What does the horizon tell us about the camera? The horizon tell us about the camera, how the camera is tilted and panned. In this image, the camera was pretty straight not exactly straight because otherwise, the orange line would be exactly horizontal. But what is important is the camera is as we see was slightly tilted. The fact that the camera is slightly tilted makes the horizon go up in the image. And if you have played with a flight simulator, you always see that the horizon is the very [COUGH] notion of the normal of the ground plane. This is how you're oriented with respect to the plane, you're going to land on with the plane, when you're flying. So the horizon gives us the full information about how the ground plane is oriented with respect to the camera. Or when the ground plane is fixed and the camera is oriented with respect to this ground plane. Now, let's look at the vertical lines, which are intersected in the image in the point C. If we would look straight and the horizon would be exactly in the center very much. Then probably this vanishing lines would appear exactly parallel and this point C would be the horizon. But because we are tilted, this point C is actually somewhere in a finite point not inside the image. But somewhere in this plane, we can very well define geometrically as in the section of this two blue vertical lines. What is a relation between this three vanishing points A, B and C? There is something that we have to clarify first. There is an apparent contradiction, if we know that the horizon depends on how oriented your camera is, then this would give us exactly the formation about where is C. Because C gives us the information how the vertical lines are oriented with respect to the camera. But this is not the case, as we see here depending on how we are oriented. But also depending on how much is the focal length, where is the image center, we'll see that the position of the vanishing point is changing. So just knowledge of A and B does not fix exactly C, we really need also the focal length and the image center in order to fix C. And we're going to now reverse this argument and say that if we have C, how are we going to compute the image center and the focal length without any calibration? That's from a single image. Let us add to the picture the projection center, this is where the lens is. And we call it point O, because these vanishing points are coming from orthogonal parallel lines. When we draw these three blue lines from the projection center to the points A, B and C, then these angles here are orthogonal. And we have noted two of those in the picture with 90 degrees. Now, how can we take advantage of this tetrahedron OABC, the triangle ABC, and the projection center outside this triangle in order to compute the image center? Let's take a special point in this triangle. This special point is intersection of all of the height of the triangles. You have learned in geometry that all of the heights of a triangle dissected just one point which we call here H. And if you see every height in the triangle, you see the green line that's always intersecting the side of 90 degrees. H is called the orthocenter of the triangle ABC. There is theorem in Euclidean geometry which says that if we have a tetrahedron and we take the line between the vertex O, and the orthocenter H, this line which is red in the image. Then if in deed this angles here are 90 degrees, then this line will be perpendicular to this plane. This is really great, because the only line from the projection center which is perpendicular to the image plane is the optical axis. And their dissection of the optical axis with the image is the image center. So by just these very simple geometrical construction, by taking three height of the triangle ABC. We get the point H, which is exactly the center of the image, the intersection of optical axis with the image plane. Let's see now whether with this simple construction, we can also find the focal length, our third unknown parameter. The image center of two coordinates in this image plane. We keep the same construction, but because it's getting complicated with the image, we omit the image behind it. And we still have the triangle ABC, we have the height The intersection H of the orthocenter. And we really want to compute f, which is the length of this solid red line. The distance from the optical center to the image plane. We're relying again on very simple geometry from the ninth grade. We only need an auxiliary light, so we're going to draw a line from the projection center o to the point d, which we have it as a dust line in this slide. We have now two right triangles. One is a triangle O, A and B. This triangle is a right triangle because the O, we have 90 degrees. So we have the O, the A, and the B. And we can prove that all these, actually perpendicular, to the line AB. Just because of the fact that they're all h is perpendicular to the plane ABC. Now in this right triangle, the high h is the geometric vein of d1 and d2 or in other words, h square equals d1 times d2. This is simple fact for every right triangle. Then let's take another triangle which is from O to h and d. And there we just apply the Pythagorean theorem. That h square, the hypotenuse is equal to d3 square plus f square. If we replace the h square in this equation, we get immediately that f square is d1 times d2 minus d3 square. And all three of them, d1, d2 and d3 are known. They are just sizes of segments in the image, which we can measure in pixels. So with this very simple way, we have computed also the focal length. To summarize, we have a picture which is a picture of a Manhattan world. Manhattan world is a world where we have three directions of orthogonal parallel lines. And we assume that these parallel lines are projected to lines of the image which intersect at vanishing points which we can compute, vanishing points which are not infinite. Like the triangle ABC, then by taking the orthocenter of this triangle, we have proven that this is the image center. And by a very simple calculation with the Pythagorean theorem. We have proven that the focal length, which is the distance of the projection center to the image plane, In this picture, is just the function of three line segment lengths in this triangle.