Take a look at these two pictures, which are stills from a video which demonstrates magnus effect in football:
I want to extract the coordinates of this ball in 3D space from this video. These are the steps I intend to use:
The ball is initially 1 m away from the camera. I can use this information to calculate the distance from camera in the later frames. (with it's angular diameter)
A football is 22 cm across. This can be used to calculate a quantity which I'm calling
anglePerPixel
(which is22/100/
. It can be used to calculate the angle of elevation of the ball from the horizon.Imagine a plane perpendicular to the ground and the camera direction, which cuts the camera view in two equal parts. It will appear as a line in the camera view. We can measure perpendicular distance of the ball from this plane
in ball units
, by measuring how many footballs we can fit between this plane and our football.
These 3 independent coordinates could be used to calculate and plot the path of this ball, i.e., if this procedure was correct, which it isn't.
I'm confident that the first step is correct. The second step yields incorrect results(about half of the expected value). The third step also looks correct to me.
How do I fix the second step? (and any mistake in the other two steps, if there's any)
Edit:
It's possible to use the method of second step to calculate the elevation as well, but it won't be very accurate since the camera is about 30 cm above ground and is aimed about 3-4 degrees above the horizon.
Maybe we could calculate the position of ball relative to the direction of the camera (instead of the ground) and try to translate it once it's done.
Answer
If you are looking for geometric accuracy, your approach is quite vague and possibly not completely accurate. I also have some doubts about your initial assumptions.
Let's say indeed, the ball's diameter is 22 cm and the distance, along the straight line on the ground, connecting the camera's position to the place where the ball touches the ground, is 100 cm. From what I am seeing on the first photo, the camera is not 30 cm above ground. Otherwise it would be looking at the ball (which is 22 cm in diameter) from above (because 22<30), while in fact, we see that the camera is looking at it a bit from below. More precisely, from what I am seeing, the camera's lower edge is placed almost on the ground and the camera is slightly tilted upwards. So I am going to assume that.
Geometrically the situation is more complex than you assume, because the ball, being originally a sphere, projects onto the photo as an ellipse. I seem to be measuring the height of the ball in the first photo at something like 3.7 cm or so, while the horizontal width seems to be something like 3.65 cm or so. However, I am going to make a simplification, otherwise things are much more complex. I am going to assume that when we are making our calculations, the 3D ball can be represented by a disk of diameter 22 cm always facing the camera fully, i.e. the plane of the disk representing the ball is parallel to the screen s. I repeat, this is not completely true, this is more of an estimate. Consequently, the results you are going to get are reasonable (I hope :) ) estimates. Intuitively, it seems to me that this approximation leads to a very small error.
First of all, for the most standard camera models, the geometric representation of a camera is a pair, consisting of a point O (point of observation) and a screen (a plane s) not passing through O. Let Os be the orthogonal projection of O onto s.
Basically, the representation of the three dimensional world onto the two dimensional screen s is obtained by connecting the observation point O to any other point P from the three dimensional space. The intersection point Ps of the straight line OP with the screen s is the two dimensional projection (2D image) of P onto the the screen s.
To be able to calculate relationships between 3D objects and their 2D images, you would need several important parameters of the camera representation. First, you would need to know the location of the point Os, the orthogonal projection of O onto s. And second, you would definitely need the distance d=|OOs| between O and the plane s. So to be able to carry out calculations like the ones you want, you need to be able to find the location of point Os and to find somehow d.
Part 1. By knowing the initial position of the ball and teh camera on photo 1 and by measuring some lengths on the photo, you can deduce the location of Os and the distance d=|OOs|.
Part 2. By measuring the coordinates of the center of the ball's image on photo 2 and by measuring/estimating the radius of the ball's image, calculate the 3D position of the ball on the second photo.
Part 1, Step 1. Fix the necessary coordinate systems on the photo and in three dimensions. According to my measurements, the frames of the first and the second photo are the same: identical rectangles with horizontal width =7.1 cm and vertical height =14.3 cm. This also allows me to assume that the photos have not been cropped. Consequently, since I believe that most cameras' screens are probably designed so that the projection Os of O onto the screen coincides with the geometric center of the screen's rectangle s, point Os should be the intersection point of the diagonals of s.
Let us introduce the 2D coordinate system Lwh to be with origin the lower left corner L of the photos, horizontal axis L→w (width) along the lower horizontal edge of the photos, and vertical axis O→h (height) along the left vertical edge of the photos. Next, let us introduce the coordinate system Osuv to be with origin point Os, horizontal axis Os→u parallel to the horizontal edge of the photos (and thus to L→w), and vertical axis Os→v parallel to the vertical edge of the photos (and thus to L→h). Finally, define the 3D ortho-normal coordinate system Oxyz, with origin O, axis O→x parallel to Os→u, axis O→z parallel to Os→v and axis O→y perpendicular to the screen s.
Observe axis O→z is not perpendicular to the ground and axis O→y is not parallel to the ground! However, axis O→x is parallel to the ground.
Part 1, Step 2. Find the location of Os in coordinate system Lwh. Now, in the coordinate system Lwh the point Os has coordinates (7.1/2,14.3/2)=(3.55,7.15). Thus u=w−3.55v=h−7.15
Part 1, Step 3. Carry out measurements and preliminary constructions on photo 1. Let A be the midpoint of the lower edge of the photos and B be the midpoint of the upper edge of the photos. Then line AB||L→h||Os→w and thus Os is the midpoint of AB (as well as Os is the intersection point of the diagonals of the photos). My measurements show (more or less) that the image of the ball on photo 1 is symmetric with respect to AB. Denote by D the point where the actual ball touches the ground. By my simplifying assumption I spoke about earlier, the 3D ball is interpreted as a flat disk of diameter 22 cm whose plane is parallel to s. Then, denote by U this disk's diametrically opposite point of D. Thus |DU|=22 cm and |AD|=100 cm. See the figure I have added below.
Then, if Ds=s∩OD and Us=s∩OU, then Ds and US are respectively the lowest and the highest intersection points of the ball's image with the vertical line AB on the screen s. Thus, we are in the situation of the figure above.
Point D′ on DU is such that OsD′ is parallel to AD, i.e. OsD′||AD, and since by assumption AB||DU, the quad ADD′Os is a parallelogram so |DD′|=|AOs|. Point D is C=OOs∩DU. Therefore, triangle OsD′C is right angled with ∠OsCD′=90∘ because OOs is orthogonal to AB and AB is parallel to DU.
I measured on photo 1 that |ADs|=4.3 cm |AOs|=12|AB|=7.15 cm |AUs|=8 cm
Part 1, Step 4. Calculate d=|OOs|. By Thales' intercept theorem (or similarity of triangles if you prefer) |DC||DU|=|DsOs||DsUs|
Part 2, Step 1. Measuring the location of the center and the radius of the ball's image on photo 2. Since the image of the ball on photo 2 is almost a circular disc (we assume that because of the earlier assumption that the real ball is represented by a disk parallel to s), I measured the distance between the lower edge of photo 2 and the lowest point from the ball's image and found that it is hl=10 cm. Similarly, the distance between the lower edge of photo 2 and the uppermost point from the ball's image is hu=10.3 cm. The horizontal distance between the left vertical edge of photo 2 (axis L→h) and either of the two points, mentioned in the previous sentence, is w2=3.87 cm. Thus, the coordinates of the center Q2 of the ball's image on photo 2 with respect to the coordinate system Lwh are approximately Q2=(w2,(hu+hl)/2)=(3.87,(10.3+10)/2)=(3.87,10.15)
For future reference, let us denote by Q the 3D center of the real ball in the case of photo 2.
Part 2, Step 2. Calculating the 3D coordinates of Q with respect to the coordinate system Oxyz. To that end, we work only with photo 2. By the simplifying assumption from before, we assume that the image of the real ball on the screen s is a circular disk (we call it image disk), and at the same time the real ball in 3D is represented by a circular disk, parallel to s (we call it real disk). Therefore the center of the real disk, which is Q, the center of the image disk Q2 and the point O are collinear. Moreover, the image disk and the real disk are (by assumption) homothetic to each other from the origin O. In other words, there is a similarity transformation (a stretching of 3D space with respect to point O) which maps the image disk to the real disk, so in particular it maps the center Q2 to the center Q, while keeping the origin O of Oxyz fixed. Thus, the coefficient of similarity (the coefficient of stretching) is λ= diameter of real disk diameter of image disk =220.3=220/3=73.33
If however, we would like to find the coordinates of Q with respect to a coordinate system Ox˜y˜z, where the latter is the rotation of Oxyz around axis O→x at an angle of −θ=−∠D′OsC=−5.624∘ so that now not only the axis O→x is parallel to the ground but also the axis O→˜y is parallel to the ground, while the axis O→˜z is vertical (orthogonal) to the ground. In order to do that, we simply have to multiply the Oxyz−coordinates of Q by the rotation matrix ROT(θ)=(1000cosθ−sinθ0sinθcosθ)=(10000.995−0.09800.0980.995)
Finally we can conclude that in the situation depicted on photo 2, the ball has moved from its initial position on photo 1, by approximately 23.47 centimeters to the right, it's height from the ground is approximately 363.5+5.142=368.642 centimeters, which is, give or take, 3 meters and 68 centimeters. Horizontally the ball has moved 14 meters and 47 centimeters from point O, which is roughly 13 meters from it's initial position.
No comments:
Post a Comment