# Homework Help: Computing the shape of the Earth as seen by a camera

1. Feb 22, 2016

### Thomas Kundera

AS: If this is not the right place to ask this question, please let me know where I could try. Thanks.
AS: I had to validate the fact I used the template to post my assignment, however I didn't (but it wouldn't post otherwise - btw it's not an "assignment").

Hello everyone.
I need help with a problem I have and couldn't find the error in made in it.

The goal is to compute the shape of the Earth curvature as saw by a camera.
First, I computed the shape of the horizon itself.
Using the attached figure for notation.

I found a circle of equation:

\left\{ \begin{array}{l}
x^2 + z^2 = l^2\\
y = h'
\end{array} \right.

With
$$h' = \frac{rh}{r + h}$$
and $$l = r \frac{\sqrt{h (2 r + h)}}{r + h}$$

Then I define an ideal pinhole camera:

The hole is at $$P(0,h,0)$$ (yes, the projection plane is front, but apart of a sign, shouldnt change anything).

I found:
$$M (x, y, z) \Rightarrow M' \left\{ \begin{array}{l} x' = \varepsilon x / z\\ y' = \frac{y - h}{z} \varepsilon + h\\ z' = \varepsilon \end{array} \right.$$

I rewrite it to be able to express the constraint for the circle:

$$M' \left\{ \begin{array}{l} x = x' \frac{y - h}{y' - h}\\ z = \varepsilon \frac{y - h}{y' - h} \end{array} \right.$$

So, my projected circle should fulfill:

$$\begin{array}{lll} M' & & \left\{ \begin{array}{l} x = x' \frac{y - h}{y' - h}\\ z = \varepsilon \frac{y - h}{y' - h}\\ z \in [\varepsilon, l]\\ x^2 + z^2 = l^2\\ y = h' \end{array} \right. \end{array}$$

Posing
$$H = h' - h$$ and $$Y' = y' - h$$:

I get:
$$\frac{Y'^2}{\left( \frac{\varepsilon^{} H^{}}{l^{}} \right)^2} - \frac{x'^2}{\varepsilon^2} = 1$$

This is the equation of an hyperbole of parameters $$a = \frac{\varepsilon H}{l}$$ and $$b = \varepsilon$$

So for now I'm happy (seems fine).

Then I just rewrite it to plot:

$$y' = \frac{H}{l} \sqrt{\varepsilon^2 + x'^2} + h$$

And halas, gnuplot draw:

Obviously wrong.

If the math are fine, I'll post my gnuplot script.
Buf first, did I made an error above?

Thanks for any help!

Thomas.

2. Feb 22, 2016

### SteamKing

Staff Emeritus
It's hard to tell, but the view in Figure 10 above seems to be really tiny, like looking at the horizon thru a keyhole.

In such a small viewport, I wouldn't expect to see much curvature on the horizon.

3. Feb 22, 2016

### haruspex

Perhaps I've not understood the set-up. Let O be the centre of the Earth and P the pinhole. The projection of the Earth through the pinhole forms a cone with axis the continuation of OP. The image plane intersects this in a conic, the type of which depends on the angle between the plane and the axis (in relation to the angle of the cone).
If the camera is a rectangular box, with P opposite to the centre of the image area, A, I do not see how this can produce a hyperbola. That would require O and A to be on the same side of the panel where P is located. I.e., the Earth is inside the camera. The only result I can imagine is an ellipse.

4. Feb 23, 2016

### Thomas Kundera

Numerical application used $$\epsilon=50mm$$ and viewport $$24 \times 36mm$$ which are pretty standard camera setting (default for any so called "full-frame" DSLD).

That's what I want to simulate.

NB: both axis should be in mm, would be nicer, but I didnt yet fixed that detail in gnuplot, so x axis is still in m.

Last edited: Feb 23, 2016
5. Feb 23, 2016

### geoffrey159

I'm not sure I understand the problem.
Are you looking for the points of the sphere (earth) limited below by a horizontal plane and above by its tangent planes meeting $A$ ? Is it something like this ?

6. Feb 23, 2016

### Thomas Kundera

Hi,

Imagine you standing by the sea, holding a camera body straight, and taking a picture. You wont see an ellipse as horizon, but something that looks like a straight line, that is in fact a very large hyperbola.

The higher you get, the more you'll see it curved. It will never form an ellipse in those conditions. But at some point, you'll tend to point your camera "down" (as the horizon lower) and then the plane of projection change, and you can get an ellipse or a circle. But I'm not there yet.

Thanks.

7. Feb 23, 2016

### Thomas Kundera

Hi,

I'm trying to simulates how the horizon looks at different altitude, first using a camera hold "'straight" (plane of projection is vertical).
So I first computed the horizon shape from a given altitude (it's a circle), and then trying to project that circle on my camera focal plane.

Seems fine? Thanks.

8. Feb 23, 2016

### geoffrey159

But explain what is to be understood by "horizon", in geometrical terms.

9. Feb 23, 2016

### Thomas Kundera

I believe that's pretty standard, should be the same definition as the one you'll find on Wikipedia (https://en.wikipedia.org/wiki/Horizon) : horizon at point P is the union of points of intersections of the tangent to the Earth passing by P with the Earth (the Earth being assimilated to a perfect sphere here).

10. Feb 23, 2016

### geoffrey159

So at this point we have an equation for this set of points, looking like :
$xx_A + yy_A + zz_A + \alpha (x + x_A) + \beta ( y + y_A) + \gamma (z+z_A) + \delta = 0$

What are we supposed to do next ?

11. Feb 23, 2016

### Thomas Kundera

I'm not sure about your general form above (shouldn't there be some squared terms somewhere?).
Anyway, once you have this set (that I computed as being a circle as said above), you want to find it's image by a central projection defined by the point P and the plane as seen of figure above.
And find the shape of this projection.

I understand that all of this seems to be related to conics, and there are certainly better ways that what I'm doing to get there...

12. Feb 23, 2016

### haruspex

I don't think we're at odds here. If the image plane is vertical then the Earth's centre is in that plane, so the image is a parabola. If you tip the camera up slightly, the centre of the Earth is now on the 'inside' of the camera, giving a hyperbola. That's the set-up I had not considered.

13. Feb 23, 2016

### geoffrey159

Well if you consider the the sphere
$S|x^2 + y^2 + z^2 + 2\alpha x + 2\beta y + 2\gamma z + \delta = 0$,
center: $(-\alpha,-\beta,-\gamma)$
radius: $\sqrt{\alpha ^2 + \beta ^2 + \gamma ^2 -\delta}$

then its tangent planes are the $T_{(x,y,z)} | xX+yY+zZ + \alpha (x+X) + \beta (y+Y) + \gamma (z+Z) + \delta = 0$.

But if you are only interested by those planes passing through $A$, you are left with two equations :

$x^2 + y^2 + z^2 + 2\alpha x + 2\beta y + 2\gamma z + \delta = 0$ and $xx_A+yy_A+zz_A+ \alpha (x+x_A) + \beta (y+y_A) + \gamma (z+z_A) + \delta = 0$

14. Feb 23, 2016

### Thomas Kundera

Yes, thanks.

15. Feb 23, 2016

### Thomas Kundera

Would you suggest me to use this forme instead of the one I used above ? It's more general and flexible, I agree.

16. Feb 24, 2016

### geoffrey159

I don't suggest anything at this point. We've just talked about some equations that must satisfy the horizon points (at A) according to the definition you wrote in post #9. The only thing I understand for the moment is that a subset of these points must appear on final screen.
What do we need to determine this subset ? Some other equations missing ? I feel that there should be at least one more equation relating the camera position to the horizon points, am I right ?
Once we have this subset of points that should appear on the screen, you have to explain how the scene is mapped to a TV screen, you talked about central projection, maybe you can start with this.

17. Feb 24, 2016

### Thomas Kundera

I used that equation for the same thing, so I ask:

\left\{ \begin{array}{l}
x^2 + z^2 = l^2\\
y = h'
\end{array} \right.

With
$$h' = \frac{rh}{r + h}$$
and $$l = r \frac{\sqrt{h (2 r + h)}}{r + h}$$

Yes, I defined this centra projection in the document above:
Then I define an ideal pinhole camera:

The hole is at $$P(0,h,0)$$ (yes, the projection plane is front, but apart of a sign, shouldnt change anything).

I found:
$$M (x, y, z) \Rightarrow M' \left\{ \begin{array}{l} x' = \varepsilon x / z\\ y' = \frac{y - h}{z} \varepsilon + h\\ z' = \varepsilon \end{array} \right.$$

I rewrite it to be able to express the constraint for the circle:

$$M' \left\{ \begin{array}{l} x = x' \frac{y - h}{y' - h}\\ z = \varepsilon \frac{y - h}{y' - h} \end{array} \right.$$

So, my projected circle should fulfill:

$$\begin{array}{lll} M' & & \left\{ \begin{array}{l} x = x' \frac{y - h}{y' - h}\\ z = \varepsilon \frac{y - h}{y' - h}\\ z \in [\varepsilon, l]\\ x^2 + z^2 = l^2\\ y = h' \end{array} \right. \end{array}$$

Posing
$$H = h' - h$$ and $$Y' = y' - h$$:

I get:
$$\frac{Y'^2}{\left( \frac{\varepsilon^{} H^{}}{l^{}} \right)^2} - \frac{x'^2}{\varepsilon^2} = 1$$

This is the equation of an hyperbole of parameters $$a = \frac{\varepsilon H}{l}$$ and $$b = \varepsilon$$

That's how I did it.

18. Feb 24, 2016

### geoffrey159

Lol this is just a copy paste of your post #1!
I think that since your camera can move vertically, if man holding the camera has position $M_0(x_0,y_0,z_0)$ at the surface of the earth, the position of the camera is $M_c(t) = M_0 + t \begin{pmatrix} x_0 + \alpha \\ y_0 + \beta \\ z_0 + \gamma \end{pmatrix}$, $t\ge 0$.
Should the camera be aligned with $A$ ?

Last edited: Feb 24, 2016
19. Mar 6, 2016

### Thomas Kundera

Hi,
Thanks again for your answer. Got some time again, so I'm back on the subject.

My camera position is fully described by the single parameter "h" that gives its altitude to the surface, as I'm only considering a camera hold "straight".

Straight means that the projection plane is vertical. In he computation, I put the pinhole on the vertical axis considered, the projection plane being a bit front (so not exactly locally "vertical", it is at the same vertical than pinhole P).

I dont think that anything is missing.

Once I have defined what is the horizon at a given point P at an altitude h (this is a know set of points), I just want to project this set using a central projection of center P on a plane that is parallel to the vertical at P at a distance $\epsilon$ from that vertical.

I wish I could be more precise...

Hum, maybe like this:

Let a sphere S of center O (0,0,0) and radius r.
Let a point P(0,r+h,0) h>0
Let H being the set of horizon points of the sphere as seen from P (that is the intersection between (the tangents to S that pass by P) and S).
Let F be a plane parallel to OP at a distance $\epsilon$ of that line, $\epsilon$ < r (so you dont have ton consider cases
when the plane would not intersect the sphere) F could be defined fully by a point F0(0,0,$\epsilon$), and two vectors: vx(1,0,0) and vy(0,1,0)
Let C be the central projection of center P on the plane F

The question is: what is the image of H by C?

Maybe that's better now ?

(of course, 0,x,y,z is an orthonormal referential in an euclidean space, etc.)

20. Mar 6, 2016

### Thomas Kundera

Hi,

Thanks everyone. I finally found my error. Now my result is compatible with Povray rendering of a similar scene and looks comparable to some ISS picts showing Earth shape from orbit.

Thanks again.

PS:
Error is stupid: y=-h in the circle equation, not y=+h...