Ghost
Ghost

Reputation: 450

Measurement unit for image of a spherical object

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.

enter image description here

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

Answers (1)

Cimbali
Cimbali

Reputation: 11405

General idea

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.

Definitions

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.

coordinate system's vectors

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 :

angles illustrated
(source: motionscript.com)

angles defined from coordinates.

Now we can convert each point into spherical coordinates and compute the distance between them.

Convert to spherical coordinates

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.

measure z

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].

measure y

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.

Distance between points on a sphere

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.

final formula from mathexchange question

Now we replace elements of the formula in term of the c1, c2, b1 and b2 we previously computed :

c and b, 1 and 2

The formula you eventually get is final formula, 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 :

  • expand the difference inside the cosine
  • in the only non-trivial term transform the phi's cosines with sqrt(1-sin2)
  • push both sin(theta) of that term inside the square root, some multiplying with the sin(phi) will give you the b squared terms
  • express remaining squared sines under the square root as 1-cos2

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 bs and cs, you only need the size of r and respectively ys and zs 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

Related Questions