Reputation: 450
What is the unit to measure distence between any 2 points in an image of a spherical object.
For example the distance between the 2 red points on the tennis ball.
NOTE: As a matter of fact, the "Euclidean distance" cannot be used, since ball is non-Euclidean. Ball is almost spherical, the imaging system projects the ball surface on a plane, where the image elements are not equispaced, neither represent equal areas. The true Euclidean distance depends on the actual position of the points with respect to the camera.
Upvotes: 2
Views: 1750
Reputation: 11405
Supposing the picture takes an isometric projection of space, we can measure coordinates on the picture as if they were coordinates on a plane.
From there we can transform them into an arbitrary ball-centric spherical coordinate system, and then we'll easily get the distance between them.
Let us suppose you know the radius r of the sphere. We'll use a coordinate system centered at the center of the sphere, with x the direction orthonormal to the plane projection induced by the picture (thus the vector comes right out of the photo). Then the directions y and z are in the picture, let's take y horizontal and z vertical. See drawing for reference.
Then the spherical coordinate system induced by this is such that we have a distance to the centre which is always r
on the sphere, and 2 angles theta and phi :
(source: motionscript.com)
.
Now we can convert each point into spherical coordinates and compute the distance between them.
For each point, the z
coordinate is the vertical distance on the picture between the point and the horizontal line that cuts the ball in two equal halves. Express it in terms of r
, the radius of the ball, thus z = c * r
, with c
in [-1,1]
, negative if the point is below the line, positive if above.
We know that z = r * cos(theta)
, so theta = arccos(c)
. Since theta is in [0,Π]
, no special cases here.
Now measure y
in the same way, which is the horizontal distance (to the right is positive) between the point and the vertical line cutting the ball in 2. With y = r * b
, and b
in [-1,1]
.
We need theta's sine, which is sin(theta) = sqrt(1 - c*c)
, then it comes that phi = arcsin( b / sqrt(1 - c*c) )
. Because we can see the point on the picture, we know that it has x > 0
by definition of our coordinate system. That means that phi
is in [-Π/2,Π/2]
, so again, no tricks or surprises in the trigonometry here.
Well everything is explained in this math exchange question, because most great-arc distances are expressed in terms of latitude and longitude, which use different conventions.
Now we replace elements of the formula in term of the c1, c2, b1 and b2 we previously computed :
The formula you eventually get is , where cos-1 is also known as the arccos function.
I won't delve into the detail (especially because it's such a pain to include latex from a mobile app), but the steps are :
The final unit of measure will be in whatever unit you express r
.
As you can see, you only need the radius at the end, after the arccos (for b
s and c
s, you only need the size of r
and respectively y
s and z
s on the picture, not in the physical world).
Then, if you are only going to compare distances of points on that same sphere, you may simplify by r
, and compare the angles between points at the center of the sphere (i.e. use only the arccos's result without multiplying by r
), since these angles are proportional to the arc's distances on the sphere. Your unit of measurement would then be in radians.
Upvotes: 2